if(mysql_num_rows($validate_voter)>0)
{
$msg1 = 1; //msg1: 1=Cheater, 2=Not cheater
$msg2 = 2; //msg2: 1=Display, 2=Don't Display
header("Location: http:" . $filename . "?" . $php_query . "&pollreq=" . $poll_results_page . "&msg1=" . $msg1 . "&msg2=" . $msg2 . "#poll");
}
elseif(isset($_COOKIE["r3nPoll"]))
{
$msg1 = 1; //msg1: 1=Cheater, 2=Not cheater
$msg2 = 2; //msg2: 1=Display, 2=Don't Display
header("Location: http:" . $filename . "?" . $php_query . "&pollreq=" . $poll_results_page . "&msg1=" . $msg1 . "&msg2=" . $msg2 . "#poll");
}
else
{
$msg1 = 2; //msg1: 1=Cheater, 2=Not cheater
$msg2 = 2; //msg2: 1=Display, 2=Don't Display
$cookie_value = 'Voted for option ' . $voteID;
$cookie_expire_time = time() + 15768000; // valid for one year
$cookie_path = '/';
setcookie ('r3nPoll' , $cookie_value , $cookie_expire_time , $cookie_path);
header("Location: http:" . $filename . "?" . $php_query . "&pollreq=" . $poll_results_page . "&msg1=" . $msg1 . "&msg2=" . $msg2 . "#poll");
}
Ok, so this is the code i have now. I have cut out the mySQL querys because they take up a lot of room -- but just so ya know, they add the client's IP addy into the DB.
So, when i cast a vote -- the script adds the users' IP into the database and gives them the cookie (r3n@websrv[1].txt).
When they try and re-vote it dosent let them because the IP and cookie is blocked. Or so it seems...
But -- (and this is the annoying bit) -- when i delete the IP from the DB and rely on the cookie to stop the user from re-voting, it just enumerates the cookie and makes it r3n@websrv[2].txt instead -- allowing the user to re-vote.
If i use
elseif(!isset($_COOKIE["r3nPoll"]))
(notice the added ! mark) -- it stops the user voting all together regardless of wether there is an IP in the DB or they have a cookie.
Why is it doing this?