Page 1 of 1

counter on page

Posted: Mon Nov 21, 2005 3:31 pm
by daan
now when a visitor visits my page, he remembers the number of houses he has looked at, but i would like to change this in the number of times a certain house is visited (number of times by all the visitors)

Code: Select all

if($a1[AgentID] != $_SESSION[AgentID])
{
	if(!empty($_COOKIE[RealEstates]))
	{
		$CookieArray = explode("|", $_COOKIE[RealEstates]);
		array_unique($CookieArray);

		$rev = count($CookieArray);

		if(!in_array($_GET[id], $CookieArray))
		{
			$NewValue = $_COOKIE[RealEstates]."|".$_GET[id];
			setcookie ("what come's here?", $NewValue);

			$ch = '1';
		}
	}
	else
	{
		setcookie ("wat come's here?", $_GET[id]);
	}




	if($rev == '0' || empty($rev))
	{
		$HomeCount = 1;
	}
	else
	{
		if(isset($ch))
		{
			$HomeCount = $rev + 1;
		}
		else
		{
			$HomeCount = $rev;
		}
	}

	$HomeViews = $HomeCount." people visited this page.";
}
could anyone help me?

Posted: Mon Nov 21, 2005 4:10 pm
by Zoxive
You wont be able to tell the number of times of all visitors unless you have some type of database set up, to store that, cookies are set on the clients computer only, session is on the server, but its only per person, So you'll need a database to save how many per person.

-NSF