opalelement Posted December 31, 2008 Share Posted December 31, 2008 I have a login script that I need to set the path on when I make the cookies... But I also have a remember me option. How would I make it so that the non-remember me cookies expire like normal at the end of the session, but still have a path of "/"? I tried this: if(isset($_POST['remember'])) { setcookie("username", $name, time()+2592000, "/"); setcookie("password", enc($pass), time()+2592000, "/"); } else { setcookie("username", $name, "", "/"); setcookie("password", enc($pass), "", "/"); } Link to comment https://forums.phpfreaks.com/topic/138955-solved-cookies-set-path-but-not-expire-time/ Share on other sites More sharing options...
opalelement Posted December 31, 2008 Author Share Posted December 31, 2008 Sorry, didn't think to try 0 as the expire time til right after I submitted. setcookie("username", $name, 0, "/"); setcookie("password", enc($pass), 0, "/"); Link to comment https://forums.phpfreaks.com/topic/138955-solved-cookies-set-path-but-not-expire-time/#findComment-726764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.