require("include/top.php");
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;
?>
if($_SESSION["SCENEID_ID"]): ?>
$i = 0;
if (!empty($logos))
{
foreach ($logos as $logo) { // we display each logo
?>
}
}
else
{
?>
no logo left, you are now a l4m4h |
|
get back
|
|
}
?>
else: ?>
endif; ?>
require("include/bottom.php"); ?>