-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.php
More file actions
142 lines (127 loc) · 6.16 KB
/
point.php
File metadata and controls
142 lines (127 loc) · 6.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php include ('header.inc.php');?>
<div class="style29" style="width:240px; float:left;">
<?php include ('left.php');?>
</div>
<?php
$cachedir='cache'; // ชื่อแฟ้มเก็บไฟล์แคช
$file='point.html'; // ชื่อไฟล์เว็บ
$cachefile=$cachedir.'/'.$file;
$cachetime =1300; // ระยะเวลา 100 วินาที
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) {
include($cachefile);
echo " <p style='color:gray;font-size:0.7em;'> ข้อมูลเมื่อ ".date('jS F Y H:i', filemtime($cachefile))." </p> "; // แสดงข้อความเวลาที่บันทึก
//exit;
}else{
ob_start();
?>
<style type="text/css">
<!--
.style68 {font-size: 12px; font-family: Tahoma; color: #CCCCCC; }
.style74 {
font-size: 18px;
font-weight: bold;
color: #FF9621;
}
.style79 {
font-size: 24px;
color: #FFB12D;
}
.style80 {color: #0099CC}
.style81 {color: #00FF00}
-->
</style>
<div style="width:790px; float:right; ">
<table width="780" border="0" align="center" cellspacing="1" bgcolor="#202020" style="margin-top:5px;">
<tr>
<td height="42" colspan="8" background="bg-menu1.jpg" bgcolor="#004000"><div align="center" class="style5">
<div align="left"> <span class="style24">อันดับ Point ประจำเดือน</span></div>
</div></td>
</tr>
<tr>
<td width="7%" height="41" bgcolor="#000000"><div align="center" class="style27"><span class="style28">ลำดับ</span></div></td>
<td width="9%" bgcolor="#000000"><div align="center" class="style27">AVATAR</div></td>
<td width="22%" bgcolor="#000000"><div align="center" class="style27"><span class="style28">USERNAME</span></div></td>
<td width="15%" bgcolor="#000000"><div align="center" class="style27"><span class="style28">ทายทั้งหมด</span></div></td>
<td width="11%" bgcolor="#000000"><div align="center" class="style27"><span class="style28">ชนะ</span></div></td>
<td width="11%" bgcolor="#000000"><div align="center" class="style27"><span class="style28">เสมอ</span></div></td>
<td width="10%" bgcolor="#000000"><div align="center" class="style27"><span class="style28">แพ้</span></div></td>
<td width="15%" bgcolor="#000000"><div align="center" class="style27"><span class="style28">แต้มทั้งหมด</span></div></td>
</tr>
<?php
$sql="
SELECT
*,SUM(winloss) AS total
FROM
playgame
JOIN members
ON members.code=playgame.memberID
WHERE
cal = '1' AND
playgame.date_create > DATE_SUB(DATE(NOW()), INTERVAL 1 MONTH)
AND gametype='point'
GROUP BY
memberID
ORDER BY
members.score
DESC
;";
// echo $sql;
$query=mysql_query($sql);
$loop =0;
while($row=mysql_fetch_assoc($query)){
$loop++;
if($loop % 2 == 0){
$bgb ="#282828";
}else{
$bgb ="#1D1D1D";
}
//$user = DisplayUser($row['memberID']);
$query_photo=mysql_query("SELECT username,photo FROM members WHERE code = '".$row['memberID']."' ;",$conn);
$row_photo=mysql_fetch_assoc($query_photo);
//$new_time = strtotime($row['Date']);
// $new_time = strtotime($row['Date']);
?>
<tr bgcolor="<?=$bgb?>">
<td height="35"><div align="center"><span class="style18 style74"><span class="style79"><?php echo $loop;?></span></span></div></td>
<td><?php if ( $row_photo['photo']!='') { ?>
<div style="width:50px; height:50px; border:solid 1px #999999; overflow:hidden;"><img src="thumb.php?src=memberpic/<?php echo $row_photo['photo'];?>&w=50&q=100" width="50" /></div>
<?php }else{ ?>
<div style="width:50px; height:50px; border:solid 1px #999999; overflow:hidden;"><img src="thumb.php?src=images/pro-pic.jpg&w=50&q=100" width="50" /></div>
<?php } ?></td>
<td><div align="center"><span class="style67 style18"><strong><span class="style67"><a style="color:#FFCC33;" href="viewmemberplay.php?refID=<?php echo $row['memberID'];?>"><?php echo $row_photo['username']; ?></a> </span></strong></span></div></td>
<td><div class="style20" style="width:80%; margin:auto; padding:5px; border:solid 1px #FFFF00 ">
<div align="center" class="style25"><?php echo CountPlay($row['memberID']);?></div>
</div></td>
<td><div class="style20" style="width:80%; margin:auto; padding:5px; border:solid 1px #00FF00 ">
<div align="center" class="style25 style81"><?php echo CountWin($row['memberID']);?></div>
</div></td>
<td><div class="style20" style="width:80%; margin:auto; padding:5px; border:solid 1px #0099CC ">
<div align="center" class="style25 style80"><?php echo CountDraw($row['memberID']);?></div>
</div></td>
<td><div class="style20" style="width:80%; margin:auto; padding:5px; border:solid 1px #FF0000 ">
<div align="center" class="style25 style62"><?php echo CountLoss($row['memberID']);?></div>
</div></td>
<td><span class="style18"></span>
<div class="style20" style="width:80%; margin:auto; padding:5px; border:solid 1px #FFFF00 ">
<div align="center" class="style25"><?php echo number_format($row['score']);?></div>
</div></td>
</tr>
<?php
}
mysql_free_result($query);
?>
</table>
</div>
<?php include('footer.inc.php');?>
<?php
$cachedata = ob_get_contents();
// BOTTOM of your script
$fp = fopen($cachefile, 'w'); // open the cache file for writing
fwrite($fp, $cachedata); // save the contents of output buffer to the file
fclose($fp); // close the file
ob_end_clean();
ob_end_flush(); // Send the output to the browser
echo $cachedata;
}
?>