unsider Posted January 7, 2008 Share Posted January 7, 2008 I've been searching for some good relatively short code for a 'remember me', but I just can't find one. If you guys have any code, or any links to a good tutorial, it would be much appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/84802-solved-adding-a-remember-me/ Share on other sites More sharing options...
revraz Posted January 7, 2008 Share Posted January 7, 2008 Assuming you are using a checkbox if (isset ($_POST['rememberme'])) { setcookie ('uname', $_POST['uname'], time () + (60*60*24*365),'/'); } Quote Link to comment https://forums.phpfreaks.com/topic/84802-solved-adding-a-remember-me/#findComment-432307 Share on other sites More sharing options...
p2grace Posted January 7, 2008 Share Posted January 7, 2008 Make sure you set the cookie in the outer most folder of that website. Cookies work for the current folder and subfolders, but if you set the cookie in a subfolder you can't call it from a parent folder. I.E. If your address is www.example.com and your folder is /var/www/html/ you'll need to set the cookie in the html folder, not a subfolder inside of the html folder. Quote Link to comment https://forums.phpfreaks.com/topic/84802-solved-adding-a-remember-me/#findComment-432333 Share on other sites More sharing options...
unsider Posted January 7, 2008 Author Share Posted January 7, 2008 Thanks guys. Quote Link to comment https://forums.phpfreaks.com/topic/84802-solved-adding-a-remember-me/#findComment-432517 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.