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 pathrandom.php
235 lines (215 loc) · 6.02 KB
/
random.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
<?
require("include/top.php");
?>
<br />
<table><tr>
<td valign="top" align="center">
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2" margin="5">
<tr>
<th colspan="3" style="text-align:center">hidden gem</th>
</tr>
<?
$sql = " SELECT *,prods.id as id, ".
" g1.name as groupn1,g1.acronym as groupacron1, ".
" g2.name as groupn2,g2.acronym as groupacron2, ".
" g3.name as groupn3,g3.acronym as groupacron3, ".
" prods.name as name, ".
" platforms.name as platform ".
" FROM prods ".
" JOIN prods_platforms JOIN platforms ".
" LEFT JOIN groups AS g1 ON prods.group1 = g1.id".
" LEFT JOIN groups AS g2 ON prods.group2 = g2.id".
" LEFT JOIN groups AS g3 ON prods.group3 = g3.id".
" WHERE prods_platforms.prod=prods.id ".
" AND prods_platforms.platform=platforms.id ".
" AND prods.voteavg > 0.99 ".
" ORDER BY RAND() LIMIT 1";
flush();
$r = mysql_query($sql) or die(mysql_error());
$n = 0;
$y = date("Y")+1;
$c = "";
while($o = mysql_fetch_object($r)) {
$year = date("Y",strtotime($o->date));
if ($year < $y || $c != $o->category) {
$y = $year;
$c = $o->category;
}
?>
<tr class="bg<?=((($n++)&1)+1)?>">
<td>
<?
//$o->sotype=="awardwinner"?" style='font-weight:bold;'":""
$typ = explode(",", $o->type);
foreach($typ as $p) {
?><a href="prodlist.php?type[]=<?=$p?>"><img src="gfx/types/<?=$types[$p]?>" border="0" title="<?=$p?>" alt="<?=$p?>"></a><?
}
?>
<a href="prod.php?which=<?=$o->id?>"><?=$o->name?></a>
</td>
<td>
<?
$a = array();
if ($o->group1) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group1,$o->groupn1);
if ($o->group2) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group2,$o->groupn2);
if ($o->group3) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group3,$o->groupn3);
echo implode(" :: ",$a);
?>
</td>
<td>
<?
$platforms = explode(",", $o->platform);
foreach($platforms as $p) {
?><a href="prodlist.php?platform[]=<?=$p?>"><img src="gfx/os/<?=$os[$p]?>" border="0" title="<?=$p?>"></a><?
}
?>
</td>
</tr>
<?
}
?>
<tr>
<th colspan="3" style="text-align:center">unvoted</th>
</tr>
<?
$sql = " SELECT *,prods.id as id, ".
" g1.name as groupn1,g1.acronym as groupacron1, ".
" g2.name as groupn2,g2.acronym as groupacron2, ".
" g3.name as groupn3,g3.acronym as groupacron3, ".
" prods.name as name, ".
" platforms.name as platform ".
" FROM prods ".
" JOIN prods_platforms JOIN platforms ".
" LEFT JOIN groups AS g1 ON prods.group1 = g1.id".
" LEFT JOIN groups AS g2 ON prods.group2 = g2.id".
" LEFT JOIN groups AS g3 ON prods.group3 = g3.id".
" WHERE prods_platforms.prod=prods.id ".
" AND prods.voteup=0 ".
" AND prods.votepig=0 ".
" AND prods.votedown=0 ".
" AND prods_platforms.platform=platforms.id ".
" ORDER BY RAND() LIMIT 1";
flush();
$r = mysql_query($sql) or die(mysql_error());
$n = 0;
$y = date("Y")+1;
$c = "";
while($o = mysql_fetch_object($r)) {
$year = date("Y",strtotime($o->date));
if ($year < $y || $c != $o->category) {
$y = $year;
$c = $o->category;
}
?>
<tr class="bg<?=((($n++)&1)+1)?>">
<td>
<?
//$o->sotype=="awardwinner"?" style='font-weight:bold;'":""
$typ = explode(",", $o->type);
foreach($typ as $p) {
?><a href="prodlist.php?type[]=<?=$p?>"><img src="gfx/types/<?=$types[$p]?>" border="0" title="<?=$p?>" alt="<?=$p?>"></a><?
}
?>
<a href="prod.php?which=<?=$o->id?>"><?=$o->name?></a>
</td>
<td>
<?
$a = array();
if ($o->group1) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group1,$o->groupn1);
if ($o->group2) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group2,$o->groupn2);
if ($o->group3) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group3,$o->groupn3);
echo implode(" :: ",$a);
?>
</td>
<td>
<?
$platforms = explode(",", $o->platform);
foreach($platforms as $p) {
?><a href="prodlist.php?platform[]=<?=$p?>"><img src="gfx/os/<?=$os[$p]?>" border="0" title="<?=$p?>"></a><?
}
?>
</td>
</tr>
<?
}
$notypes = array("32b", "64b", "128b", "512b", "1k", "8k", "16k", "32k", "80k", "96k", "100k", "128k", "256k", "artpack", "fastdemo", "report", "votedisk");
foreach ($types as $key => $value) {
if (!in_array($key, $notypes)) {
?>
<tr>
<th colspan="3" style="text-align:center"><? print($key); ?></th>
</tr>
<?
$sql = " SELECT *,prods.id as id, ".
" g1.name as groupn1,g1.acronym as groupacron1, ".
" g2.name as groupn2,g2.acronym as groupacron2, ".
" g3.name as groupn3,g3.acronym as groupacron3, ".
" prods.name as name, ".
" platforms.name as platform ".
" FROM prods ".
" JOIN prods_platforms JOIN platforms ".
" LEFT JOIN groups AS g1 ON prods.group1 = g1.id".
" LEFT JOIN groups AS g2 ON prods.group2 = g2.id".
" LEFT JOIN groups AS g3 ON prods.group3 = g3.id".
" WHERE prods_platforms.prod=prods.id ".
" AND prods.type like '".$key."' ".
" AND prods_platforms.platform=platforms.id ".
" ORDER BY RAND() LIMIT 1";
flush();
$r = mysql_query($sql) or die(mysql_error());
$n = 0;
$y = date("Y")+1;
$c = "";
while($o = mysql_fetch_object($r)) {
$year = date("Y",strtotime($o->date));
if ($year < $y || $c != $o->category) {
$y = $year;
$c = $o->category;
}
?>
<tr class="bg<?=((($n++)&1)+1)?>">
<td>
<?
//$o->sotype=="awardwinner"?" style='font-weight:bold;'":""
$typ = explode(",", $o->type);
foreach($typ as $p) {
?><a href="prodlist.php?type[]=<?=$p?>"><img src="gfx/types/<?=$types[$p]?>" border="0" title="<?=$p?>" alt="<?=$p?>"></a><?
}
?>
<a href="prod.php?which=<?=$o->id?>"><?=$o->name?></a>
</td>
<td>
<?
$a = array();
if ($o->group1) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group1,$o->groupn1);
if ($o->group2) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group2,$o->groupn2);
if ($o->group3) $a[] = sprintf("<a href='groups.php?which=%d'>%s</a>",$o->group3,$o->groupn3);
echo implode(" :: ",$a);
?>
</td>
<td>
<?
$platforms = explode(",", $o->platform);
foreach($platforms as $p) {
?><a href="prodlist.php?platform[]=<?=$p?>"><img src="gfx/os/<?=$os[$p]?>" border="0" title="<?=$p?>"></a><?
}
?>
</td>
</tr>
<?
}
}
}
?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<? require("include/bottom.php"); ?>