i use the following visitors counter on my web and i am moving web to new server. on the old place, the counter runs ok, on the new one it adds count even when i reload the page. what could be wrong with the settings or whatever else when the code used is the same? or please does someone know other simple counter that counts only one visit from a user within specified time period???
<?
$SPath=$PATH_INFO;
$CookieDeath=720;
@$Conn=mysql_connect("s","s","s");
mysql_select_db("s");
if (empty($CounterID)){
$SQLText="SELECT FROM Tcounter WHERE SPath='$SPath'";
$result=mysql_query($SQLText);
if (mysql_num_rows($result)==0){
$SQLText="INSERT INTO Tcounter (SPath,Visits) VALUES ('$SPath',1)";
$result=mysql_query($SQLText);
$Visits=1;
$CounterID=mysql_insert_id($result);
}
else{
$row=mysql_fetch_array($result);
$Visits=++$row["Visits"];
$CounterID=$row["CounterID"];
$SQLText="UPDATE Tcounter SET Visits=$Visits WHERE CounterID=$CounterID";
$result=mysql_query($SQLText);
}
}
else{
$SQLText="SELECT Visits FROM Tcounter WHERE CounterID=$CounterID";
$result=mysql_query($SQLText);
$row=mysql_fetch_array($result);
$Visits=$row["Visits"];
}
mysql_close($Conn);
setcookie("CounterID",$CounterID,(time()+$CookieDeath60));
echo "$Visits";
?>