Hi,
I need some help..
I have created to pages...The first checks if there is such cookie and if not it sets cookie and redirects to the second page..It checks if the first has succeeded to put a cookie and does something..but they do not work..Whre is the problem..Thi is the code...
##############page 1 ##################
<?php
$vid = 2; # for test purposes only in normal cases it changes dynamically
if($vid){
$vid = "n".$vid;
if($$vid == 1){
echo"You have already voted !";
}else{
$lifetime = time() + 5000;
setcookie($vid,1,$lifetime,"mydomain");
echo"<body><script>document.location.href='testvote/?vid=$vid'</script></body>";
}
}
?>
#############page 2###################
<?php
echo $vid; # for test purposes only
echo $$vid; # for test purposes only
if($$vid == 1){
$lifetime = time() + 5000;
setcookie("$vid",2,$lifetime, "mydomain");
echo "do something";
}
else
{
echo "please enable cookies";
}
?>
#############end##################
It always sasy please enable cookies...
Please help me....It is simple but I just can not see it..