shedokan Posted July 22, 2008 Share Posted July 22, 2008 I am creating a website which will have a login script and I am not sure if to use sessions or cookies. what would you suggest? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/ Share on other sites More sharing options...
unkwntech Posted July 22, 2008 Share Posted July 22, 2008 Sessions are typically better. IMO Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/#findComment-596409 Share on other sites More sharing options...
MadTechie Posted July 22, 2008 Share Posted July 22, 2008 I agree, but you may want to have a cookie for a "remember me" option (just remember the cookies data can be accessed and edited by the user, so don't add their password or access right in their) Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/#findComment-596414 Share on other sites More sharing options...
unkwntech Posted July 22, 2008 Share Posted July 22, 2008 Also as a reminder ALWAYS ALWAYS sanitize the users input before sending it along in an SQL query mysql_escape_string() see this page for details http://www.php.net/manual/en/function.mysql-escape-string.php Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/#findComment-596420 Share on other sites More sharing options...
shedokan Posted July 22, 2008 Author Share Posted July 22, 2008 ok thanks, so you mean I should use sessions and if the user wants I will use cookies to remember him for next time? Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/#findComment-596435 Share on other sites More sharing options...
unkwntech Posted July 22, 2008 Share Posted July 22, 2008 yes Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/#findComment-596440 Share on other sites More sharing options...
MadTechie Posted July 22, 2008 Share Posted July 22, 2008 yes, just remember Sessions will die then the user quits the browser where as cookies won't (well depends on their life span), but cookies can be controlled by the user where as sessions can not.. Quote Link to comment https://forums.phpfreaks.com/topic/116001-sessions-or-cookies/#findComment-596441 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.