Page 1 of 1
Cookies and localhost
Posted: Tue Mar 25, 2003 8:39 am
by homerwells
Do cookies work on personal servers? I'm trying it out and it doesn´t seem to work. Is there any special configuration that should be worked on for them to work?
Thanks,
Leo.
Posted: Tue Mar 25, 2003 9:11 am
by twigletmac
They should work - what does your code look like?
Mac
Posted: Tue Mar 25, 2003 9:18 am
by homerwells
<?
setcookie("cookie[login]", true);
?>
then in a different file, same dir:
<?
if ($cookie['login'] == true)
echo "LOGADO";
else
echo "NÃO LOGADO";
?>
the error is:
Notice: Undefined variable: cookie in c:\web\labic\gerencia\teste_session2.php on line 3
NÃO LOGADO
Posted: Tue Mar 25, 2003 9:27 am
by sleepingdanny
Try to upload the 2 files that you told us to your site... OR maybe the code can't work because it should look like this
Code: Select all
<?
if(isset($_COOKIE["login"])){
print "Logged In";
}
else{
print "Not Logged In";
}
?>