1
How to record sessions in the browser with php.
Currently I have a login system, and always validates [$_SESSIONS]
existing in the browser, but every time I close and open the browser again, the login no longer exists.
How best to save data in the browser.
- It will be useful to use COOKIES?
- I must save sessions in Database?
What is the best way to do this process, for whenever you log in you never have to log in?
What I would do: Save the user and password of the guy who logged in to the cookie and when he logs in, see if you have Session, if you don’t have it, you create it
– Francisco
That doesn’t sound very reliable. Let’s say I log into another user’s PC, see their credentials, then just copy the cookies to my PC and always access their account without really knowing the password.
– Tiago165
save a random secret code to a persistent cookie after the first login, also saving the hash of that cookie in your database. If a user accesses the site without being logged in, but has a valid code, then it is considered that it is the same user returning to the site and you automatically authenticate it. See https://answall.com/questions/85566/op%C3%A7%C3%A3o-keep-connected Remind me
– user60252