idire Posted September 26, 2008 Share Posted September 26, 2008 I currently use sessions extensively throughout my website, but have had users complain about the lack of remembering login from a computer. I have looked up cookies, but don't really understand what I need to do to store/retrieve, and what to create? Link to comment https://forums.phpfreaks.com/topic/125978-cookies-for-autologin/ Share on other sites More sharing options...
Alkimuz Posted September 26, 2008 Share Posted September 26, 2008 you can set one by using the code: setcookie("name you wat to give to cookie", "the information you want to store in the cookie", the time you want the cookie to exist in seconds); so for example: $name = 'idire'; setcookie("UsersName", $name, time()+3600); you can read the cookie by using the code: $_COOKIE['Name of the cookie']; so for example echo 'hello '.$_COOKIE['UserName']; will show: hello idire good luck Link to comment https://forums.phpfreaks.com/topic/125978-cookies-for-autologin/#findComment-651527 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.