Mach es mit dem Datum
CREATE TABLE statistics (
day tinyint(2) unsigned NOT NULL default '0',
month tinyint(2) unsigned NOT NULL default '0',
year smallint(4) unsigned NOT NULL default '0',
pageimps smallint(4) unsigned NOT NULL default '0'
) TYPE=MyISAM;
Eintrage-Script wie folgt:
PHP-Code:
<?
require_once("dbconnect.php");
mysql_query("UPDATE statistics SET pageimps=pageimps+1 WHERE day='0' AND month='0' AND year='0'");
// Page Impressions pro Tag
$datum=getdate(time());
$ergebnis=mysql_query("SELECT day FROM statistics
WHERE day='".$datum['mday']."' AND month='".$datum['mon']."' AND year='".$datum['year']."'");
if(mysql_numrows($ergebnis)==0) mysql_query("INSERT INTO statistics
(day,month,year,pageimps) VALUES ('".$datum['mday']."','".$datum['mon']."','".$datum['year']."','1')");
else mysql_query("UPDATE statistics SET pageimps=pageimps+1
WHERE day='".$datum['mday']."' AND month='".$datum['mon']."' AND year='".$datum['year']."'");
mysql_close($verbindung);
header("Content-type: image/gif");
include("leer.gif"); ?>
Alle Seitenaufrufe insgesamt befinden sich dort, wo alle Datumsangaben 0 sind, die pro Tag dort, wo das aktuelle Datum drinsteht... ich hab damit keine Performance-Probleme, obwohl bei Lycos gehostet *g* hab aber auch nur hundert bis zweihundert Aufrufe täglich...

da das Script auf einem anderen Server als die Page liegt, wird es als Bild eingebunden.