I'm trying to implement a “remember me” system using cookies that the user will remember in browsers, which means that if a user logs on to a website using browser A and checks “remember me” and then logs in browser B, remember me, "it will continue to automatically register regardless of which browser it uses. (checking" remember me "in browser B will not break its constant login to browser A).
To do this, I configured my database so that several keys could be stored next to the user ID. When a user logs in to my website, the cookie value is checked. If this value is found in the database, a new cookie is assigned to the user, and this cookie key entry in the database is updated to match. Other keys remain valid, so the persistence of entering the browser will not be affected. When the user logs out manually, the cookie is checked, the corresponding record in the database is deleted, and then the cookie is deleted.
The problem occurs when the user manually deletes his cookie. If the user does this, I cannot delete the corresponding entry in the database. It will just become a permanent entry in my database. This is not a problem when I did not try to support the cross-browser "remember me", but became a problem, allowing you to store multiple cookie keys.
Is there any way I can fix / avoid this?
There is a lot of information about persistent logins, but persistent logins in browsers are never considered, so any help would be great. (Also, feel free to criticize my approach and any security issues. It seemed safer when I only allowed “remember me” for each user, but persistent recordings in browsers seem like functionality that users want).
MySQL PHP.