I was wanting a way to track if a user was logged in. Each page of the site would validate if the user is logged in or not and would deny access if they are not logged in. This would keep people from going directly to a page on the site without logging in first.
I read up on php sessions, but it was suggested that a database solution might be better. I believe they mean have a field in the user table that denotes if they are logged in or not and then each page validates against that field.
I could set a cookie once they are logged in and then each page could look for that cookie. I am just wondering what solution is generally agreed upon. There are a few different ways to do this, but which one is widely accepted?


