This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcdc.php
313 lines (283 loc) · 11.4 KB
/
cdc.php
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<?
require("include/top.php");
function SQLToDate($sqldate) {
global $months;
$txtdate=substr($sqldate,-2);
$txtdate.=" ";
$txtdate.=$months[sprintf("%d",substr($sqldate,5,2))];
$txtdate.=" ";
$txtdate.=substr($sqldate,0,4);
return $txtdate;
}
$query="SELECT cdc.which,cdc.quand,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM cdc,prods WHERE cdc.which=prods.id AND cdc.quand<=NOW() ORDER BY cdc.quand DESC";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)) {
$cdc[]=$tmp;
}
for ($i=0; $i<count($cdc); $i++):
if ($cdc[$i]["group1"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$cdc[$i]["groupname1"]=$tmp["name"];
$cdc[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if ($cdc[$i]["group2"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$cdc[$i]["groupname2"]=$tmp["name"];
$cdc[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if ($cdc[$i]["group3"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group3"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$cdc[$i]["groupname3"]=$tmp["name"];
$cdc[$i]["groupacron3"]=$tmp["acronym"];
}
endif;
if (strlen($cdc[$i]["groupname1"].$cdc[$i]["groupname2"].$cdc[$i]["groupname3"])>27):
if (strlen($cdc[$i]["groupname1"])>10 && $cdc[$i]["groupacron1"]) $cdc[$i]["groupname1"]=$cdc[$i]["groupacron1"];
if (strlen($cdc[$i]["groupname2"])>10 && $cdc[$i]["groupacron2"]) $cdc[$i]["groupname2"]=$cdc[$i]["groupacron2"];
if (strlen($cdc[$i]["groupname3"])>10 && $cdc[$i]["groupacron3"]) $cdc[$i]["groupname3"]=$cdc[$i]["groupacron3"];
endif;
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$cdc[$i]["which"]."' and platforms.id=prods_platforms.platform";
$result=mysql_query($query);
$check=0;
$cdc[$i]["platform"]="";
while($tmp = mysql_fetch_array($result)) {
if ($check>0) $cdc[$i]["platform"].=",";
$check++;
$cdc[$i]["platform"].=$tmp["name"];
}
//print($query."<->".$cdc[$i]["platform"]."<br/>");
endfor;
$query=" SELECT distinct prods.id as which,count(prods.id) as count,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM users_cdcs JOIN prods WHERE users_cdcs.cdc=prods.id group by prods.id order by count desc";
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)) {
$pcdc[]=$tmp;
}
for ($i=0; $i<count($pcdc); $i++):
if ($pcdc[$i]["group1"]):
$query="select name,acronym from groups where id='".$pcdc[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$pcdc[$i]["groupname1"]=$tmp["name"];
$pcdc[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if ($pcdc[$i]["group2"]):
$query="select name,acronym from groups where id='".$pcdc[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$pcdc[$i]["groupname2"]=$tmp["name"];
$pcdc[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if ($pcdc[$i]["group3"]):
$query="select name,acronym from groups where id='".$pcdc[$i]["group3"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$pcdc[$i]["groupname3"]=$tmp["name"];
$pcdc[$i]["groupacron3"]=$tmp["acronym"];
}
endif;
if (strlen($pcdc[$i]["groupname1"].$pcdc[$i]["groupname2"].$pcdc[$i]["groupname3"])>27):
if (strlen($pcdc[$i]["groupname1"])>10 && $pcdc[$i]["groupacron1"]) $pcdc[$i]["groupname1"]=$pcdc[$i]["groupacron1"];
if (strlen($pcdc[$i]["groupname2"])>10 && $pcdc[$i]["groupacron2"]) $pcdc[$i]["groupname2"]=$pcdc[$i]["groupacron2"];
if (strlen($pcdc[$i]["groupname3"])>10 && $pcdc[$i]["groupacron3"]) $pcdc[$i]["groupname3"]=$pcdc[$i]["groupacron3"];
endif;
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$pcdc[$i]["which"]."' and platforms.id=prods_platforms.platform";
$result=mysql_query($query);
$check=0;
$pcdc[$i]["platform"]="";
while($tmp = mysql_fetch_array($result)) {
if ($check>0) $pcdc[$i]["platform"].=",";
$check++;
$pcdc[$i]["platform"].=$tmp["name"];
}
endfor;
/*
//sceneorgrecommended check
$result=mysql_query("SELECT sceneorgrecommended.prodid, sceneorgrecommended.type, sceneorgrecommended.category, prods.name,prods.type,prods.group1,prods.group2,prods.group3 from sceneorgrecommended LEFT JOIN prods ON prods.id=sceneorgrecommended.prodid WHERE sceneorgrecommended.type='viewingtip' ORDER BY prods.date");
while($tmp=mysql_fetch_array($result)) {
$rec[]=$tmp;
}
for ($i=0; $i<count($rec); $i++):
if ($rec[$i]["group1"]):
$query="select name,acronym from groups where id='".$rec[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$rec[$i]["groupname1"]=$tmp["name"];
$rec[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if ($rec[$i]["group2"]):
$query="select name,acronym from groups where id='".$rec[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$rec[$i]["groupname2"]=$tmp["name"];
$rec[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if ($rec[$i]["group3"]):
$query="select name,acronym from groups where id='".$rec[$i]["group3"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$rec[$i]["groupname3"]=$tmp["name"];
$rec[$i]["groupacron3"]=$tmp["acronym"];
}
endif;
if (strlen($rec[$i]["groupname1"].$rec[$i]["groupname2"].$rec[$i]["groupname3"])>27):
if (strlen($rec[$i]["groupname1"])>10 && $rec[$i]["groupacron1"]) $rec[$i]["groupname1"]=$rec[$i]["groupacron1"];
if (strlen($rec[$i]["groupname2"])>10 && $rec[$i]["groupacron2"]) $rec[$i]["groupname2"]=$rec[$i]["groupacron2"];
if (strlen($rec[$i]["groupname3"])>10 && $rec[$i]["groupacron3"]) $rec[$i]["groupname3"]=$rec[$i]["groupacron3"];
endif;
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$rec[$i]["prodid"]."' and platforms.id=prods_platforms.platform";
$result=mysql_query($query);
$check=0;
$rec[$i]["platform"]="";
while($tmp = mysql_fetch_array($result)) {
if ($check>0) $rec[$i]["platform"].=",";
$check++;
$rec[$i]["platform"].=$tmp["name"];
}
endfor;
*/
?>
<br />
<table><tr>
<td valign="top" align="center">
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr>
<td bgcolor="#224488" colspan="4">
<table cellspacing="0" cellpadding="0"><tr>
<td><img src="gfx/titles/coupdecoeur.gif"></td>
<td> <b>moderators coup de coeur history</b></td>
</tr></table>
</td>
</tr>
<? for($i=0;$i<count($cdc);$i++):
if($i%2) {
print("<tr bgcolor=\"#446688\">");
} else {
print("<tr bgcolor=\"#557799\">");
}
$typess = explode(",", $cdc[$i]["type"]);
print("<td nowrap><table cellspacing=\"0\" cellpadding=\"0\"><tr><td nowrap><a href=\"prod.php?which=".$cdc[$i]["which"]."\">");
for($k=0;$k<count($typess);$k++) {
print("<img src=\"gfx/types/".$types[$typess[$k]]."\" width=\"16\" height=\"16\" border=\"0\" title=\"".$typess[$k]."\">");
}
print("<br /></a></td><td><img src=\"gfx/z.gif\" width=\"2\" height=\"1\" border=\"0\"><br /></td><td nowrap><a href=\"prod.php?which=".$cdc[$i]["which"]."\">".strtolower(stripslashes($cdc[$i]["name"]))."</a><br /></td><td> </td>");
print("<td width=\"100%\"> </td>");
$platforms = explode(",", $cdc[$i]["platform"]);
for($kkk=0;$kkk<count($platforms);$kkk++) {
?><td align="right"><a href="prodlist.php?platform[]=<? print($platforms[$kkk]); ?>"><img src="gfx/os/<? print($os[$platforms[$kkk]]); ?>" width="16" height="16" border="0" title="<? print($platforms[$kkk]); ?>"></a><br /></td><?
}
print("</tr></table></td>\n");
?>
<td nowrap>
<? if(strlen($cdc[$i]["groupname1"])): ?>
<a href="groups.php?which=<? print($cdc[$i]["group1"]); ?>">
<? print(strtolower($cdc[$i]["groupname1"])); ?>
</a>
<? else: ?>
<? endif; ?>
<? if(strlen($cdc[$i]["groupname2"])): ?>
::
<a href="groups.php?which=<? print($cdc[$i]["group2"]); ?>">
<? print(strtolower($cdc[$i]["groupname2"])); ?>
</a>
<? endif; ?>
<? if(strlen($cdc[$i]["groupname3"])): ?>
::
<a href="groups.php?which=<? print($cdc[$i]["group3"]); ?>">
<? print(strtolower($cdc[$i]["groupname3"])); ?>
</a>
<? endif; ?>
</td>
<td align="right" nowrap>
<? print(sprintf("%d",substr($cdc[$i]["quand"],-2))); ?>
<? print(substr($months[sprintf("%d",substr($cdc[$i]["quand"],5,2))],0,3)); ?>
<? print(substr($cdc[$i]["quand"],0,4)); ?>
</td>
</tr>
<? endfor; ?>
</table>
</td>
</tr>
</table>
<br /></td></tr><tr><td valign="top" align="center">
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr>
<td bgcolor="#224488" colspan="4">
<table cellspacing="0" cellpadding="0"><tr>
<td><img src="gfx/titles/coupdecoeur.gif"></td>
<td> <b>glopers pcdc, top of the hearts</b></td>
</tr></table>
</td>
</tr>
<? for($i=0;$i<count($pcdc);$i++):
if($i%2) {
print("<tr bgcolor=\"#446688\">");
} else {
print("<tr bgcolor=\"#557799\">");
}
$typess = explode(",", $pcdc[$i]["type"]);
print("<td nowrap><table cellspacing=\"0\" cellpadding=\"0\"><tr><td nowrap><a href=\"prod.php?which=".$pcdc[$i]["which"]."\">");
for($k=0;$k<count($typess);$k++) {
print("<img src=\"gfx/types/".$types[$typess[$k]]."\" width=\"16\" height=\"16\" border=\"0\" title=\"".$typess[$k]."\">");
}
print("<br /></a></td><td><img src=\"gfx/z.gif\" width=\"2\" height=\"1\" border=\"0\"><br /></td><td nowrap><a href=\"prod.php?which=".$pcdc[$i]["which"]."\">".strtolower(stripslashes($pcdc[$i]["name"]))."</a><br /></td><td> </td>");
print("<td width=\"100%\"> </td>");
$platforms = explode(",", $pcdc[$i]["platform"]);
for($kkk=0;$kkk<count($platforms);$kkk++) {
?><td align="right"><a href="prodlist.php?platform[]=<? print($platforms[$kkk]); ?>"><img src="gfx/os/<? print($os[$platforms[$kkk]]); ?>" width="16" height="16" border="0" title="<? print($platforms[$kkk]); ?>"></a><br /></td><?
}
print("</tr></table></td>\n");
?>
<td nowrap>
<? if(strlen($pcdc[$i]["groupname1"])): ?>
<a href="groups.php?which=<? print($pcdc[$i]["group1"]); ?>">
<? print(strtolower($pcdc[$i]["groupname1"])); ?>
</a>
<? else: ?>
<? endif; ?>
<? if(strlen($pcdc[$i]["groupname2"])): ?>
::
<a href="groups.php?which=<? print($pcdc[$i]["group2"]); ?>">
<? print(strtolower($pcdc[$i]["groupname2"])); ?>
</a>
<? endif; ?>
<? if(strlen($pcdc[$i]["groupname3"])): ?>
::
<a href="groups.php?which=<? print($pcdc[$i]["group3"]); ?>">
<? print(strtolower($pcdc[$i]["groupname3"])); ?>
</a>
<? endif; ?>
</td>
<td>
<? print($pcdc[$i]["count"]); ?>
</td>
</tr>
<? endfor; ?>
</table>
</td>
</tr>
</table>
<br /></td>
</tr>
</table>
<br />
<? require("include/bottom.php"); ?>