Jump to content

Trouble with cookies and Safari


chaos421
 Share

Recommended Posts

Hey all. First post here.

 

I'm having some difficulty with cookies and Safari. I've pasted my code below. isValidUser is a function that queries the database. When I test it out on Chrome it works well. In Safari I'm able to log in, but as soon as I navigate away from the page, the cookies disappear. I've tried several permutations with the URL at the end of setcookie including with or without leading '.' and with or without trailing '/' without success.

 

Any help would be greatly appreciated.

 

Thanks,

Keith

/*------------------------------------------------------------------- *  login *   *  username: is the person's e-mail address *  password: is stored separately *-------------------------------------------------------------------*/function login ($username, $password){	    if (!isValidUser($username, $password))        return false;	    setcookie('username', $username, time()+60*60*24*365, '/', '.northernlightsnordic.org');    setcookie('password', md5($password), time()+60*60*24*365, '/', '.northernlightsnordic.org');    return true;} //end login/*------------------------------------------------------------------- *  logout *   *  *-------------------------------------------------------------------*/function logout (){    setcookie('username', "", time() - 3600, '/', '.northernlightsnordic.org');    setcookie('password', "", time() - 3600, '/', '.northernlightsnordic.org');    return true;} //end logout
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...