To store things like if logged in settings, user ID and user levels. Whats the best place to store them. Session or cookie?
Session means logging in each visit which a pain for people but other than that is one better than the other?
Use the $_SESSION[''] and add a checkbox "Remember This" for their browsers to remember the user login credentials. That way, they can auto login. Just make sure to add an alert that they should not check the checkbox if they're on a public computer. As in a library or internet cafe.
I'm gonna do this.
Now, go and read tutorials on how to write the "Remember This" feature with php. I have forgotten how to code it. Last I did about half a dacade ago. I too need to read up on it. Revision.
Good ? 🙂
Session is a way to temporarily store the user information on the server-side, whereas cookies store the information on the user's computer until it expires. I think Sessions are more secure than cookies as it is stored in server. Cookie can be turned off from browser.
User can access the COOKIE since it's on clientside.
User can't access the SESSION since it's on serverside. Now you decide which is safer!