I did a couple of quick searches and got stumped as I went along. How would I display the number of visitors browsing my site. At first I figured cookies, but since I am an ASP guy, I’m thinking something more along the lines of a global.asa file(used in ASP) How does php know who’s browsing? I’m guessing now that I need an external php file(which is why i mentioned global.asa)
Could soemone point me in the right direction, a link would be nice 
If you looking for a user count like ‘5 users currently online’ this php script works fine and just uses a php file + flat file database to keep the counts: http://www.diction.net/php_downloads/download.php?f=usersonline&e=zip
(download appears popup)
i made this for my site, it counts users and logs data about them 
$handle = fopen("counter.txt", "r");
$contents = fgets($handle, 4096);
$temp = sprintf("%d", $contents);
$temp++;
fclose($handle);
$handle = fopen("counter.txt", "w");
fputs($handle, "$temp");
fclose($handle);
$handle = fopen("log.txt", "a+");
fputs($handle, "$temp . ");
fputs($handle, "[ "."$_SERVER[REMOTE_ADDR]"." ]");
fputs($handle, "[ ".gethostbyaddr($_SERVER[REMOTE_ADDR])." ]");
fputs($handle, "[ ".date("l, F jS, Y g:i:d a")." ]");
fputs($handle, "<br>");
fclose($handle);
counter.txt simply contains an integer, log.txt contains stuff like this
1686 . [ 216.221.81.99 ][ authorized_proxy4.cogeco.net ][ Tuesday, July 8th, 2003 9:17:08 am ]<br>1687 . [ 24.52.207.152 ][ oh-bainbridge1c-152.clvhoh.adelphia.net ][ Tuesday, July 8th, 2003 9:38:08 am ]<br>1688 . [ 65.92.38.119 ][ HSE-Kitchener-ppp3506329.sympatico.ca ][ Tuesday, July 8th, 2003 10:07:08 am ]<br>1689 . [ 65.92.38.119 ][ HSE-Kitchener-ppp3506329.sympatico.ca ][ Tuesday, July 8th, 2003 10:07:08 am ]<br>1690 . [ 158.182.53.180 ][ 158.182.53.180 ][ Tuesday, July 8th, 2003 10:58:08 am ]<br>1691 . [ 199.182.39.156 ][ dsc04-lai-ca-2-156.rasserver.net ][ Tuesday, July 8th, 2003 11:59:08 am ]<br>
hope that helps =)
thank the both of you,
ahmed:
i am still new at php so forgive me, but all i have to do is create 2 textfiles, and that script will write to them?
thanks again
you don’t have to create the textfiles, when the script is run, if the files do not exist, it creates them =)
if you want to know how this actually works, look up the functions in the php docs 
*Originally posted by ahmed *
**you don’t have to create the textfiles, when the script is run, if the files do not exist, it creates them =)
if you want to know how this actually works, look up the functions in the php docs
**
make sure your folders are chmoded to the correct value or the files won’t be created.
also, you want to know how is browsing at one time? or a total count?
http://www.daydreamgraphics.com/tutorials/list.php?action=list&cat_id=2&id=94
that might help for the number of people that are online, but do you want to display more information about them? like usernames, similar to how the forum is run? or just the total number of online users at the moment…
hmm, well i dont have a members section for my site, i do for the forums, but they already display users info.
pretty much i just want to have on my index page
“There are currently x Visitors online”
when they are in the forum, ill let the already installed code handle it’s own
I took a look at that link Jubb, that looks like it will answer my questions.
Ahmed, thanks but honestly you lost me
not sure how to incorparate what u said into what I want to do
I’ll give this a go, and repost my problems(cuz i know there will be some, just a question of how many)
thanks guys
you can also IM me anytime if you need real-time help 