|
Posted by seaside on 07/15/07 16:24
On Jul 13, 10:45 pm, Ciaran <cronok...@hotmail.com> wrote:
> Hi I've seen this a few places - The site lists off the number of
> people (not logged in) currently browsing the site. How can I do this
> with php / mySQL please?
In case you'd like to know, at least of _some_ users, how long they
visited your
site, you may use AJAX.
Bind XHTMLRequest to a timer event, let this timer event fire e.g.
each minute
once and let the XHTMLRequest call a log script on your site.
Obviously, this technique on works, if clients enabled JavaScript.
Another option:
Embed an iFrame in each page of your site, set it the refresh e.g.
once each minute
in the iFrame's HTML HEAD section. Embed a <img > in the iFrame's
source and
assign your logging script to the SRC-attribute of the IMG-element. To
not render
an error, you should return a transparent 1x1 image.
You need to be sensible regarding the initial client-request of this
iFrame, since
you need to assign somehow a unique ID for each new client.
___
Stefan
[Back to original message]
|