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), "", "/"); } Quote 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, "/"); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.