ngreenwood6 Posted September 11, 2008 Share Posted September 11, 2008 I was told by someone to use the session set save handler. I do not know how to use this function. Basically I am trying to prevent users from logging in from the same ip address. I want to do it with the mysql database and I have it working. However it only works if the user ends the session with the logout page. If they just close the window and dont log out it doesnt get changed in the database. So someone told me to use the session set save handler. I was hoping that someone could give me an example of how to use this function as I have googled it and can find no good resources or tutorials. If you know of an easier/better way please explain. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/123832-sessions/ Share on other sites More sharing options...
phpretard Posted September 11, 2008 Share Posted September 11, 2008 I found this. I don't know if it helps though. // session garbage collection: function mysql_sess_gc ($sess_maxlife) { global $mysql_sess_conn_id; $time=date("format_of_date_used_in_t_column",now()-$sess_maxlife); $query="SELECT * FROM sessions WHERE t<'$time' "; $r=mysql_query($query,$mysql_sess_conn_id); for ($i=0; $i<mysql_numrows($r); $i++) { // here you store sessions in saved_sessions table } $query = "DELETE FROM sessions WHERE t < '$time' ", mysql_query ($query, $mysql_sess_conn_id); return; } Quote Link to comment https://forums.phpfreaks.com/topic/123832-sessions/#findComment-639377 Share on other sites More sharing options...
ngreenwood6 Posted September 11, 2008 Author Share Posted September 11, 2008 I don't think that quite fits into what I am trying to accomplish but thanks for the attempt. Quote Link to comment https://forums.phpfreaks.com/topic/123832-sessions/#findComment-639397 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.