Hi, I'm having some problems with checking the state of cookies. I'm setting user_name and user_pass cookies based on a successful login from www.mysite.com/admin/login.php in www.mysite.com/admin/admin.php. It works fine as far as I can tell, the cookies get set and all is ok. One of the features I wanted to implement was to have a link on www.mysite.com which would contain a link to the login page if the user is not logged in, or a link to the admin page if the user is already logged in. I can't seem to get it to work however. The cookie is set, I know it because I can go back and forth to the admin page without getting denied access or having to login again (the way I want it) but this function,
function admin_box() {
if($user_name and $user_pass) {
// show logged in stuff
} else {
// show login form
}
}
doesn't show the "logged in stuff", always the link to the login page (ie: it fails the first and goes to the else). I've set my cookies like this:
setcookie("user_name",$user_name,(time()+2592000),'/','',0);
I've tried every way I know to check the cookie but nothing seems to work. Any help here would be greatly appreciated. I seems like the cookie is not being set site wide, but I have the "/" in there, which does that... right?