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 pathlogos.php
125 lines (109 loc) · 2.97 KB
/
logos.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
<?
require("include/top.php");
$id = $_POST['id'];
$vote = $_POST['vote'];
if (isset($_SESSION['SESSION']) && $id && $vote) {
$query = 'SELECT count(0) FROM logos_votes WHERE logo='.(int)$id.' AND user='.$_SESSION["SCENEID_ID"];
$result = mysql_query($query);
if (!mysql_result($result,0)) {
if ($vote == rulez)
$vote = 1;
else
$vote = -1;
$query = 'INSERT INTO logos_votes SET logo='.(int)$id.', user='.$_SESSION['SCENEID_ID'].', vote='.$vote;
mysql_query($query);
}
}
// Lamas pictures displayed when there are no logo to vote for anymore
$lama_pictures = array(
'logos-lamer.jpg',
'logos-lama.jpg',
'logos-dalai-lama.jpg');
// let's get all the logos + LIMIT 5
unset($tmp);
unset($logos);
$query = "SELECT logos.id,logos.file FROM logos LEFT JOIN logos_votes ON logos.id=logos_votes.logo AND logos_votes.user=" . $_SESSION["SCENEID_ID"] . " WHERE logos_votes.vote is NULL ORDER BY RAND() LIMIT 5";
$result = mysql_query($query);
while ($tmp = mysql_fetch_assoc($result))
$logos[] = $tmp;
?>
<br>
<? if($_SESSION["SCENEID_ID"]): ?>
<?
$i = 0;
if (!empty($logos))
{
foreach ($logos as $logo) { // we display each logo
?>
<form action="<?=basename($_SERVER['SCRIPT_FILENAME'])?>" method="post">
<input type="hidden" name="id" value="<?=$logo['id']?>">
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr>
<td background="gfx/trumpet.gif" align="center">
<img src="gfx/logos/<?=$logo['file']?>" hspace="50" vspace="50"><br>
</td>
</tr>
<tr>
<td bgcolor="#446688" align="right">
<input type="submit" name="vote" value="rulez">
<input type="submit" name="vote" value="sucks">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<br />
<?
}
}
else
{
?>
<table width="50%"><tr><td>
<table cellspacing="1" cellpadding="2" class="box">
<tr><th>no logo left, you are now a l4m4h</th></tr>
<tr bgcolor="#557799">
<td nowrap align="center">
<img src="gfx/<?=$lama_pictures[array_rand($lama_pictures)]?>" alt="Lamer picture">
</td>
</tr>
<tr>
<td bgcolor="#446688" align="center">
<a href="/"><b>get back</b></a><br>
</td>
</tr>
</table>
</form>
</td></tr></table>
</td></tr></table>
<?
}
?>
<? else: ?>
<table width="50%"><tr><td>
<form action="login.php" method="post">
<table cellspacing="1" cellpadding="2" class="box">
<tr><th>vote for the logos</th></tr>
<tr bgcolor="#446688">
<td nowrap align="center">
You need to be logged in to vote for the logos :: <a href="account.php">register here</a><br>
<input type="text" name="login" value="SceneID" size="15" maxlength="16" onfocus="this.value=''">
<input type="password" name="password" value="password" size="15" onfocus="javascript:if(this.value=='password') this.value='';"><br />
</td>
</tr>
<tr>
<td bgcolor="#6688AA" align="right">
<input type="image" src="gfx/submit.gif">
</td>
</tr>
</table>
</form>
</td></tr></table>
<? endif; ?>
<br>
<? require("include/bottom.php"); ?>