peranha Posted December 3, 2007 Share Posted December 3, 2007 I was woundering if there is a good tutorial on inserting session information into a database, and calling it for logging in, checking it for accessing pages, deleting it for logout, misc. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/ Share on other sites More sharing options...
Crew-Portal Posted December 3, 2007 Share Posted December 3, 2007 http://php.about.com/od/advancedphp/ss/php_sessions.htm Sorry for the slow response. it would've been faster if you posted in the PHP help section! Link to comment https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-404689 Share on other sites More sharing options...
peranha Posted December 3, 2007 Author Share Posted December 3, 2007 I already have sessions set up to store on the server, I was woundering if there is a way to store them in a SQL database and check this on the pages. Link to comment https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-404693 Share on other sites More sharing options...
Crew-Portal Posted December 3, 2007 Share Posted December 3, 2007 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 https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-404695 Share on other sites More sharing options...
PFMaBiSmAd Posted December 3, 2007 Share Posted December 3, 2007 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 https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-404737 Share on other sites More sharing options...
peranha Posted December 3, 2007 Author Share Posted December 3, 2007 I am new to this, and I read on another site that this is more secure. Link to comment https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-404743 Share on other sites More sharing options...
steelmanronald06 Posted December 3, 2007 Share Posted December 3, 2007 http://ronaldsteelman.com/2007/09/21/custom-session-handler-in-oopphp5/ that should help. it is in oop. Link to comment https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-404749 Share on other sites More sharing options...
Azu Posted December 4, 2007 Share Posted December 4, 2007 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 https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-405803 Share on other sites More sharing options...
steelmanronald06 Posted December 4, 2007 Share Posted December 4, 2007 if you know anything about programming and databases, then your database should never go down...and if it does you should have it back up in just a few minutes Link to comment https://forums.phpfreaks.com/topic/79911-solved-sessions-in-mysql-database/#findComment-406051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.