X");
}
$nojs = (isset($_GET['nojs'])) ? true : false;
$frame = (isset($_GET['frame'])) ? true : false;
$item_id = (is_numeric($_GET['id'])) ? $_GET['id'] : 0;
$vote = $_GET['vote'];
$ip_hash = ip_hash(get_ip());
if(mysql_num_rows(mysql_query("SELECT Rank FROM ext WHERE `Id`='{$item_id}'")) > 0)
{
if(mysql_num_rows(mysql_query("SELECT * FROM votes WHERE `Id`='{$item_id}' AND `Ip`='{$ip_hash}'")) == 0)
{
if($vote == "up")
{
mysql_query("UPDATE ext SET `Rank`=`Rank`+1 WHERE `Id`='{$item_id}'");
if(!$nojs)
{
echo("
+
");
}
}
elseif($vote == "down")
{
mysql_query("UPDATE ext SET `Rank`=`Rank`-1 WHERE `Id`='{$item_id}'");
if(!$nojs)
{
echo("-
");
}
}
else
{
die("X");
}
if($nojs && $frame)
{
echo("Your vote was counted.");
}
elseif($nojs)
{
echo("Your vote was counted. Click here to go back to the page you came from.");
}
mysql_query("INSERT INTO votes (`Id`, `Ip`) VALUES ('{$item_id}', '{$ip_hash}')");
}
else
{
if($nojs && $frame)
{
echo("You already voted.");
}
elseif($nojs)
{
header("Location: {$referer}");
}
else
{
die("X
");
}
}
}
}
?>