mrjameer Posted April 11, 2007 Share Posted April 11, 2007 hi, when ever a user login, his information(name,login-time..etc) will be stored in sessions and also stored in users table. the table has following fields 1.userid 2.userlogin_time(session_created_time) 3.session_expiry_time.4.session_timeout. it's values are 1----10:10:10-----10:34:10----11:46:10 here session_expiry_time is 24 minutes more than the session_created_time.the session_timeout is 72 minutes more that session_created time.ok what i want to do is if a user login and does not do any thing for next 24 minutes i want to redirect the user to login page. how i can do this.any of your help will be appreciated thanks mrjameer. Link to comment https://forums.phpfreaks.com/topic/46631-if-session-expired-redirect-them-to-login-page/ Share on other sites More sharing options...
Zaid Posted April 11, 2007 Share Posted April 11, 2007 you need to track the user activity on every page you have (so make an include file) create a field in ur db "lastactivity", so in the include file: 1)compare the time in lastactivity with now(), if it's more than...24h..or whatever, then empty session, if it's not then update lastactivity with now() i hope that helps i forgot, you need to include that file at the top, so if it's more than 24h or whatever, you need to send a header to redirect the user to your login page, headers must be sent before anything, hence you need the include file at the top Link to comment https://forums.phpfreaks.com/topic/46631-if-session-expired-redirect-them-to-login-page/#findComment-227101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.