Jump to content

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


et4891
Go to solution Solved by requinix,

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.

Link to comment
Share on other sites

  • Solution

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
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.