artweb Posted January 16, 2008 Share Posted January 16, 2008 I have a php login page that checks against a mysql database, to find if user have a password and username stored in the database. If they do they are allowed into the members only part of my website. But what I need is once a user is successfully login, is to be able to know the time they login and the date and how long they spent login. I don't want the user to have to logout, I want that to be automatic, after a certain period of time. ??? I have no cue of how to do this. Do I need another table in my database to store the users info? or do I need to use sessions and cookies somehow? Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/ Share on other sites More sharing options...
The Little Guy Posted January 16, 2008 Share Posted January 16, 2008 Something like this? http://phpsnips.com/snippet.php?id=39 Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-441162 Share on other sites More sharing options...
artweb Posted January 16, 2008 Author Share Posted January 16, 2008 Yes, only I also need the date too, and where do I go to see the info about the user sessions? Where is the info stored? Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-441174 Share on other sites More sharing options...
artweb Posted January 17, 2008 Author Share Posted January 17, 2008 OK ??? So how do I bump this up???????? Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-441878 Share on other sites More sharing options...
artweb Posted January 17, 2008 Author Share Posted January 17, 2008 I just figured this out, sorry, I'm really new :'( Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-441879 Share on other sites More sharing options...
artweb Posted January 17, 2008 Author Share Posted January 17, 2008 Still waiting is there anyone there? Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-442129 Share on other sites More sharing options...
The Little Guy Posted January 17, 2008 Share Posted January 17, 2008 could you explain a little more? Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-442226 Share on other sites More sharing options...
Aureole Posted January 17, 2008 Share Posted January 17, 2008 The info. should be stored in the $_SESSION array. Try var_dump($_SESSION); or print_r($_SESSION); Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-442228 Share on other sites More sharing options...
teng84 Posted January 17, 2008 Share Posted January 17, 2008 But what I need is once a user is successfully login, is to be able to know the time they login and the date and how long they spent login. if I will be the one to code that i will do it this way.. create a table that has this fields( if you want to track all the user log every session they made in the site) *once the user log store the id of the user on your db together with the time the user logs *everytime the user refresh the page update your field with the current time. in this case even if he turn the PC off everything is recorded you dont also have to worry about closing the browser maybe this isn't that good, any one has better idea? Quote Link to comment https://forums.phpfreaks.com/topic/86336-can-someone-help-new-to-php-and-mysql/#findComment-442240 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.