gdebojyoti.mail96
Member
- Messages
- 89
- Reaction score
- 0
- Points
- 6
My login verify script -
This stores the cookie in the broswer. No problems with this; I have checked it myself.
However in a different page when I check to see if the cookie exists, it returns false.
The above code prints "Not set" in the broswer window.
Also, if I try
the ouput is an error Notice: Undefined index: cookiename
Apparently the browser (Firefox) cannot identify the cookie, although I can see it present when I check my broswer's options tab! Later, I also tried in Chrome and IE - same issue.
What am I doing wrong?
Update: When I added
to the end of the login verify script, my cookie was detected ("Set" was printed)! But it isn't being detected in any other page.
Code:
if($pass == $hash)
setcookie("cookiename",$cookieVal);
This stores the cookie in the broswer. No problems with this; I have checked it myself.
However in a different page when I check to see if the cookie exists, it returns false.
Code:
if(isSet($_COOKIE['cookiename'])) echo "Cookie is set";
else echo "Not set";
The above code prints "Not set" in the broswer window.
Also, if I try
Code:
echo $_COOKIE['cookiename'];
Apparently the browser (Firefox) cannot identify the cookie, although I can see it present when I check my broswer's options tab! Later, I also tried in Chrome and IE - same issue.
What am I doing wrong?
Update: When I added
Code:
if(isSet($_COOKIE['cookiename'])) echo "Set";
Last edited: