Jump to content

how to use time() to count how many seconds you were here


et4891

Recommended Posts

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.

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.)

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 :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.