Jump to content

[SOLVED] Sessions in MySQL database


peranha

Recommended Posts

Make a table and put stuff like last page viewed and session_id's and stuff. When a user clicks on a link make it update the table with a new last page, where session_id = $session_id or something like that. On logout make it delete the session where session_id = $session_id, Im not a huge time programmer but what are the use of storing sessions in a database anyways. If the user doesnt log out then the session wont be deleted and you cant use it to keep people logged in because on broswer close it would change the session_id.

Link to comment
Share on other sites

There are a number of existing mysql session save handlers (just search on the Internet) that can replace the default file based save handler.

 

Is there a specific reason why you want to do this, as there is additional overhead, data bottle-necks, and possibility of session failure when the mysql server is overloaded or down.

 

With the default file based save handler, if the web server is running and your site is up, the file system is functioning and sessions would work. With a mysql based session save handler, there are several more things that can go wrong that will reduce the reliability.

Link to comment
Share on other sites

possibility of session failure when the mysql server is overloaded or down.
Wouldn't logins be messed up anyways? I mean the login data is stored in the database, anyways, right? So if your database goes down, then ya, there's going to be problems, either way..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.