Hi,
Since I got such a fast/good response I my first post I was hoping someone could help me out. I added the AddHandler line to my .htaaccess but instead of going to HotScripts or PHP Freaks to find a counter script, I decided to create my own.
Below is the script/DB queries I'm trying to test(I will expand it later), I also added <?php @include_once("counter.php");?> to an html file to test.
<?php>
require_once('mysql_connect.php');
$URL=$_SERVER['HTTP_REFERER'];
$q = "SELECT * FROM counter where url='$URL'";
$r = mysql_query($q);
$rw = mysql_fetch_array($r, MYSQL_ASSOC);
$count = $rw['count'];
$dt = date("Y-m-d");
if($rw['url'] && $rw['date'] == $dt)
$qu = mysql_query("UPDATE counter SET count = '$count + 1' WHERE url='$URL'");
else
$qu = mysql_query("INSERT INTO counter(url, count, date) VALUES ('$URL', '1', '$dt'"); // first entry
?>
My problem occurs with the $URL variable. It's not being passed the url of the html page that is calling the script. I tried setting $_SERVER['PHP_SELF'] but that just sets $URL="counter.php" Does anyone know what I'm doing wrong? I've looked on php.net for other variables but don't know which would cover what I'm trying to do.
Thanks!
Mike