Ok il try and help as you asked so kindly
This bit of code will be at the top of your page that displays the voting.
Code:
<?
if(isset($_COOKIE['guest_cookie'])) {
$cookie_ip = $_COOKIE['guest_cookie'];
$user_ip = $_SERVER['REMOTE_ADDR'];
if(strcmp($cookie_ip == $user_ip) {
echo "You have already voted on this topic";
} else {
//display voting system, whatever it is
}
} else {
//display voting system, whatever it is
}
?>
and on your page that receives the vote you would have
Code:
<?
//do whatever you normally do with it
//save using cookie, cookie will expire after 24hrs, no point saving it for longer as the users ip will change if they turn their pc on and off in between.
$user_ip = $_SERVER['REMOTE_ADDR'];
setcookie('guest_cookie', '$user_ip', time() + (60*60*24));
?>
Feel free to correct me anyone as iv just written it here and now without testing it, it will probably have something wrong with it or it could be written better.
Bookmarks