Thanks for the reply MeX
Not sure if it helps as I got a little confused by your method, but going back to my method i've got it now so the cookie would read something like
vote[0]http://www.domain.com/picture.gif
and when you vote again because the link already exists it says so.
so if i vote with another image (say image 2) it will see if the link exists, if not adding it to the cookie like:
cote[1]http://www.domain.com/picture2.gif
the only problem i have now is coz there are two cookie names in the cookie (vote[0] and vote [1], if i try to vote for picture2.gif again the result will say
doesn't existalready exists
coz first it reads the first cookie which doesn't match, then the second one does. hence adding another vote.
Hope someone understand me, here's the code now anyway:
if (isset($_COOKIE['vote']))
{
foreach ($_COOKIE['vote'] as $name => $value)
{
if($value==$link)
{
echo "already exists";
}
else
{
if($name==$count)
{
$value = $link;
$count+=1;
setcookie("vote[$count]", $value, time()+3600, "/");
echo "doesn't exist";
}
else
{
header("location: browse.php");
}
}
}
}
else
{
$value = $link;
$count = 0;
setcookie("vote[$count]", $value, time()+3600, "/");
}
What i guess i'm asking is how can i stop it from searching through each cookie and making a decision wether the link exists or not?
Thanks for all your help
Ant