-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchampion.php
More file actions
234 lines (213 loc) · 11.1 KB
/
champion.php
File metadata and controls
234 lines (213 loc) · 11.1 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php include ('header.inc.php');?>
<div class="style29" style="width:240px; float:left;">
<?php include ('cache/left.html');?>
</div>
<?php
$cachedir='cache'; // ชื่อแฟ้มเก็บไฟล์แคช
$file='champion.html'; // ชื่อไฟล์เว็บ
$cachefile=$cachedir.'/'.$file;
$cachetime =21600; // ระยะเวลา 5 นาที
//$cachetime =0; // ระยะเวลา 5 นาที
// 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="images/bg-menu1.jpg" bgcolor="#004000"><div align="center" class="style5">
<div align="left"> <span class="style24">ทำเนียบแชมป์ Point ประจำเดือน 25 อันดับ</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 like '".date('Y-m')."%'
AND playgame.gametype='point'
GROUP BY
memberID
ORDER BY
members.score
DESC
LIMIT 25
;";
// 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=50" 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=50" 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>
<table width="780" border="0" align="center" cellspacing="1" bgcolor="#202020" style="margin-top:5px;">
<tr>
<td height="42" colspan="8" background="images/bg-menu1.jpg" bgcolor="#004000"><div align="center" class="style5">
<div align="left"> <span class="style24">ทำเนียบแชมป์ Rank ประจำเดือน 25 อันดับ</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 like '".date('Y-m')."%'
AND playgame.gametype='rank'
GROUP BY
memberID
ORDER BY
members.rank
DESC
LIMIT 25
;";
// echo $sql;
$query=mysql_query($sql);
$loop =0;
while($row=mysql_fetch_assoc($query)){
$loop++;
if($loop % 2 == 0){
$bgb ="#282828";
}else{
$bgb ="#1D1D1D";
}
//$row_photo['username'] = 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="history.php?memberid=<?php echo $row['memberID'];?>"><?php echo $user;?></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['total']*2);?></div>
</div></td>
</tr>
<?php
}
mysql_free_result($query);
?>
</table>
<?php
$cachedata = ob_get_contents();
//$cachedata=str_replace('<img src="','<img src="cachepic.php?url=',$cachedata);
// 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;
}
?>
</div>
<?php include('footer.inc.php');?>