ryanwood4 Posted January 24, 2010 Share Posted January 24, 2010 Hiya, I'm trying to set a cookie to last a good 150 days or 3600 hours. But the script below doesn't seem to be adding the cookie correctly. Sometimes members are logged in for a few hours, sometimes a day. But never more than a few days. The part of the code which adds the cookie: // if login is ok then we add a cookie $_POST['email'] = stripslashes($_POST['email']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['email'], $hour); setcookie(Key_my_site, $_POST['password'], $hour); Anyone know why it isn't working correctly? Thanks. Link to comment https://forums.phpfreaks.com/topic/189652-cookie-not-working-as-it-should/ Share on other sites More sharing options...
garethhall Posted January 25, 2010 Share Posted January 25, 2010 Add "/" setcookie(ID_my_site, $_POST['email'], $hour, "/"); Link to comment https://forums.phpfreaks.com/topic/189652-cookie-not-working-as-it-should/#findComment-1001004 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.