问题描述:

I have a server with PHP and MySQL. I want to have a login screen where users can enter their email, etc. and then browse my site. What is the best way to keep the user logged in? Ie. they don't have to log in to each page. I have looked into using cookies, and recording their IP address, but I wasn't sure which was best, or if there was a better way?

网友答案:

You can create a cookie based session, whenever the user enters the credentials. The subsequent requests will be having the cookie in the request header, which can be used to identify the user.

link for reference - http://www.opensourceforu.com/2008/12/session-management-using-php-part-1-cookie-based-sessions/

相关阅读:
Top