I got the following code:
<?php
$id = $_GET['id'];
$vote = $_GET['vote'];
$month = 2592000 + time();
$cookie = "votez" . $id;
$cookiez = "viewz" . $id;
if(isset($_COOKIE[$cookiez]))
{
if(!isset($_COOKIE[$cookie]))
{
setcookie($cookie, "voted", $month, '/', ".mywebsite.co.il");
}
}
else
{
setcookie($cookiez, "viewed", $month, '/', ".mywebsite.co.il");
}
?>
lets assume that I go to > www.mywebsite.co.il/example.php?id=1&vote=1 on the first time > it will set the first cookie. on the second time > it will set the second cookie. on the third time > nothing will happen
this is how it should work.
but if I go to > www.mywebsite.co.il?/example.php?id=1&vote=2 (after I was at www.mywebsite.co.il/example.php?id=1&vote=1) it will set the first cookie again.
if I will go to > www.mywebsite.co.il?/example.php?id=1&vote=3 (after I was at www.mywebsite.co.il/example.php?id=1&vote=1) it will set the first cookie again.
and so on..
what do I need to do so no matter what the vote equal, as long as its the same ID, the cookie will be the same?
(this is not the full code and you dont need the full code in order to understand the problem or to solve it).
thanks!.