I could't get it to work, but i found some scripts and put them together and got them to work.
<?php
include("config.php");
$sql = mysql_query("SELECT * FROM `ip_hits`");
while ($hit = mysql_fetch_array($sql)) {
}
$date = gmdate(j);
$month = gmdate(F);
$sup = gmdate(S);
$year = gmdate(Y);
$datestamp = $date. '' .$sup. ' ' .$month. ' ' .$year. '';
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'])
? $_SERVER['HTTP_X_FORWARDED_FOR']
: $_SERVER['REMOTE_ADDR'];
$hit_sql = mysql_query("SELECT * FROM `ip_hits` WHERE `ip` = '" .$ip. "'");
if (mysql_num_rows($hit_sql) == "0") {
mysql_query("INSERT INTO `ip_hits` ( `ip` , `clicks` , `date` ) VALUES ('" .$ip. "', '1', '" .$date. "')");
}
else {
$hit = mysql_fetch_array($hit_sql);
$new_hits = $hit["clicks"] + 1;
mysql_query("UPDATE `ip_hits` SET `clicks` = '" .$new_hits. "', `date` = '" .$datestamp. "' WHERE `ip` = '" .$ip. "'");
}
$show = mysql_query("SELECT * FROM ip_hits"); //Get all the data from the database for showing the count
$show2 = MYSQL_NUM_ROWS($show); //Count the rows
echo "Unike sidetreff: $show2"; //Echo the # of unique hits
?>
It shows Unique Ip's, Total clicks, and last date online