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?
Asked
Active
Viewed 68 times
-5
-
3Use $_SESSION, it should be more than enough. – uraimo May 11 '15 at 19:53
-
Possible duplicate of ["Keep Me Logged In" - the best approach](http://stackoverflow.com/questions/1354999/keep-me-logged-in-the-best-approach) – Cœur Mar 25 '17 at 15:47
1 Answers
0
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/

Arvindkumar
- 184
- 2
- 16