Welcome to WebmasterWorld Guest from 54.166.46.226

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

website visitor duration

php website visitor duration

   
6:17 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



Hi guys/gals,

How do i create a clock that starts when the person enters a website and displays a live clock i.e.

Your session duration is: x

x is a live clock that ticks away in realtime.

I have not come accross any decent links so if anyone can advise i'd appreciate it.

8:23 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I recommend a clock made in flash. Certainly not in PHP, maybe in Java or Javascript. Depends on the type of clock (analog, digital, etc).

PHP is not meant for real-time things, as it is processed on the server side, not client side.

1:59 am on Jan 24, 2005 (gmt 0)

10+ Year Member



Yeah that is what i was starting to think.

Thanks for your update

12:24 pm on Jan 25, 2005 (gmt 0)

10+ Year Member



On a side note you could create a session variable that would grab a time stamp when a user enters and when they leave then you could do a calculation between the two to figure of how long the visited.
3:03 pm on Jan 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



true, but that's not a clock. A clock for me is sth that's ticking, and changing at least once a minute. It could be done with php (reloading the page every minute) but it would be extremely annoying for the user
8:21 pm on Jan 28, 2005 (gmt 0)

10+ Year Member



If you have the timestamp of when the user entered the site stored in a session variable then you could use
PHP to create the javascript (that then creates the clock) and seed it with the correct time (the session variable). This could be used in a header thats included in any page on your site and would show the total amount of time a user has been at your site.
8:34 pm on Jan 28, 2005 (gmt 0)

10+ Year Member



why not simply echo it out? who needs a clock anyway :)
just my 0.02 ofcourse