krike Posted August 4, 2009 Share Posted August 4, 2009 I have 2 questions the main question I have is the following, I made a tutorial system and the user system is based on sessions. I'm saving 4 things into sessions; id, unique_id, username & password now I would like to use cookies so you don't have to login each time you visit the site, what information should I store into cookies ? the id or username and pass? which one is saver? my second questions: which method is best for date when storing it into a database? mysql timestamp or the php date() function? Quote Link to comment https://forums.phpfreaks.com/topic/168791-cookies-and-date/ Share on other sites More sharing options...
ram4nd Posted August 6, 2009 Share Posted August 6, 2009 I think it's not safe to keep username and password in session at the same time Quote Link to comment https://forums.phpfreaks.com/topic/168791-cookies-and-date/#findComment-892305 Share on other sites More sharing options...
krike Posted August 6, 2009 Author Share Posted August 6, 2009 someone allready helped me thanks anyway if anyone is interested: - for the cookies I store a md5 hash of the password and a unique_id (6 digits) generated when a user register. So should be good. - and for the date I use the time function $t=time()+60*60*24*7; //7 days = 1 week echo $t . "<br />"; //output example 1249579107 echo date("Y-m-d",$t); //output example 2009-08-05 Quote Link to comment https://forums.phpfreaks.com/topic/168791-cookies-and-date/#findComment-892366 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.