homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

website visitor duration
php website visitor duration

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

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)

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)

Yeah that is what i was starting to think.

Thanks for your update


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

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)

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)

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)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved