et4891 Posted March 3, 2013 Share Posted March 3, 2013 Hi, I'm creating a script and let's say I have a user/pass to enter and once it's entered another page will be redirected and in that page will show a line sayingi you have been staying here for xxx seconds. I'm using $_SESSION at the moment but I'm not sure how to set up so time() will start counting after logged in. Link to comment https://forums.phpfreaks.com/topic/275149-how-to-use-time-to-count-how-many-seconds-you-were-here/ Share on other sites More sharing options...
requinix Posted March 3, 2013 Share Posted March 3, 2013 You don't "start counting" anything. Record when the logged in, then every page (or whenever) you do time()-that value to get the number of seconds elapsed. (Then reformat into hours/minutes/seconds/whatever if you want something better looking.) Link to comment https://forums.phpfreaks.com/topic/275149-how-to-use-time-to-count-how-many-seconds-you-were-here/#findComment-1416131 Share on other sites More sharing options...
et4891 Posted March 3, 2013 Author Share Posted March 3, 2013 You don't "start counting" anything. Record when the logged in, then every page (or whenever) you do time()-that value to get the number of seconds elapsed. (Then reformat into hours/minutes/seconds/whatever if you want something better looking.) hehe that's what I did but I realized I put it the script into the wrong .php script file Link to comment https://forums.phpfreaks.com/topic/275149-how-to-use-time-to-count-how-many-seconds-you-were-here/#findComment-1416134 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.