$SPath=$PATH_INFO; $CookieDeath=20; @$Conn=mysql_connect("sql5.hostcreators.sk:3310","u22620_Eghva36","7raxMokXa*"); mysql_select_db("d22620_chemoxa_sk_CTjA"); 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()+$CookieDeath*60)); ?>
|
|
|