execute wrote:
I also found that once a hacker or anything finds out your temp folder, or some insecurity in your website could create a gateway for someone to log into your website without even registering.
PHP session handling requires that the session id is passed from page to page via a cookie or a URI variable. PHP will look after the mechanics of this, you just tell it how you want to work. See here for details.
Once you extract the session id from either of the above methods, you then need to validate that session. There are any number of ways to do that, and what makes sense to you is up to you.
For instance if you detect that the last activity on a particular session id was more than 'n' minutes ago, you might want to reauthenticate the user. If you do decide to reauthenticate, you need to decide whether to reprompt for username and password, or just password. Alternatively you might just bin the sesison and create a new one, with reauthentication.
If you detect that the last http request on a particular session was from a different IP address,, you might want to bin the whole session.
If you detect that the browser agent has changed since the last http request on the session, you might want to get suspicious.
etc etc
Session details are stored on the servcer, but the server ID comes from the client. So you always have to rigorously challenge any session ID which comes in.
You may want to limit yourself to only storing session id on the client side, and storing everything else, preferences, history etc on the server side.
If you store everything else on the server side, you need to consider resource implications. Using too manys ession variables can be a waste of server ram. Running to the database for everything can be a waste of time.
Decisions, decisions...
edit: broke the original quote by deleting a bracket :rolleyes: