I have the following MySQL DB based hit counter:
<?php
if (empty ( $count ) )
{
setcookie( "count", "counted", "0" );
$user_agent = getenv("HTTP_USER_AGENT");
$IP_address = getenv("REMOTE_ADDR");
include("mysql.php");
$sql = "INSERT INTO hitcounter VALUES ( '', '$user_agent', '$IP_address', now() ) ";
$result = mysql_query( $sql, $link );
mysql_close( $link );
}
else {}
?>
The database populates properly, but the cookie seems not to set and every time I revisit the page, the counter goes up. The purpose of the cookie is so that it increments for each new visit to the website, not each time they view a particular page during that visit.
Any ideas?
R