> I've been looking for a script to determine who is on my page (people
> have to log in). So far, I've been using a script that updates the
time
> in the database continuously as long as the person is on the page.
That
> way, the script could determine whether the user is still online or
not.
> However, this script has way too many queries and uses too much server
> resources. Is there anything else? I'm wondering if the
> connection_status() function would help in any way...

Connection_status() is for something else.

Remember how HTTP works. The server receives a request, it sends a file,
you receive it, and that's it. There is no more communication. There is
_no_ way to tell how many people are on your page, plain and simple.

What you can do, however, is something like you're doing now. With each
_request_ to a page (not every second, or however you're doing it now),
update a time in a database. To see how many people are "on your site"
you can select a count of how many users have times that are less than X
minutes old. You have to assume that if they requested a page X minutes
ago, they are more than likely still on your page. 

Since this isn't rocket science, this assumption will be adequate for
your needs. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to