Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Guests currently browsing my site

Status
Not open for further replies.

alsaffar

Programmer
Oct 25, 2001
165
KW
Hi there,

How can I count how many guests are browsing my site currently?

I don't want to use cookies, since its disabled at some machines. I know there is a way because I saw some sites counting the number of guests without sending a cookie to my machine.

Please help
 
They probably logged your IP and incremented a counter, then after say five mintues of no activity from your IP they remove it from the list. Then all they have to do is count IPs.
 
Or if they have to log in, just count the number of people logged in. Obviously if they don't log out it will stay on the list, but you can do they whole 'log them out after x amount of time' thing like a lot of sites do.
 
I use Mysql to count the number of visitors... I use 3 fields

dbip
dbtime
dbdate


this way i can sort the data to the number of unique visitors per day, the number of hits per day, and the rush hours of traffic.

if yer a noob and don't know how to setup Mysql or Apache then i suggest you try Apache2Triad... It even comes with a MySql Web Frontend
 
I use this function for my visitors. the colors are diminishing when they haven't reloaded my page in a certain time

Code:
function Opforum($conn){
$hourdiff = "0";
$houradjust = ($hourdiff *60 * 60);
$minutediff = "30";
$minuteadjust = ($minutediff * 60);
$datum = gmdate("Y-m-d H:i:s",time() - $minuteadjust + $houradjust);

$query="SELECT lluname,date_format(llulastonforum,'%Y-%m-%d %H:%i:%s') as datumlaatst FROM lowlandusers order by llulastonforum desc";
$rs2=mysql_query($query,$conn);
$list = mysql_num_rows($rs2); 

while($i < $list)	
	{
	$row = mysql_fetch_array($rs2); 
	$naamuser=$row[&quot;lluname&quot;];
	$datumlaatst=$row[&quot;datumlaatst&quot;];
	if ($datumlaatst > $datum) {
		$test=strtotime($datumlaatst);
		$test2=strtotime($datum);
		$test3=$test - $test2;
		$tijd=$minutediff - ($test-$test2)/60;
		if ($tijd >=&quot;0&quot; AND $tijd < &quot;2&quot;) {$kleurcode=&quot;33ff66&quot;;}
		if ($tijd >=2 AND $tijd < 5) {$kleurcode=&quot;33cc66&quot;;}
		if ($tijd >=5 AND $tijd < 10) {$kleurcode=&quot;333366&quot;;}
		if ($tijd >=10 AND $tijd < 20) {$kleurcode=&quot;006666&quot;;}
		if ($tijd >=20 AND $tijd < 30) {$kleurcode=&quot;003300&quot;;}
 		print &quot;<font color=$kleurcode>$naamuser </font>&quot;;
 		}
	$i++;
	}

}

I update the last time they reloaded my first page at the usertable. then compare it with the currenttime

sorry most variables are in dutch ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top