counter on page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
daan
Forum Commoner
Posts: 25
Joined: Wed Nov 16, 2005 10:32 am

counter on page

Post 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?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post 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
Post Reply