PHP-Code:
<?php
$actuell_date=date("d.m.Y");
$ip=getenv("REMOTE_ADDR");
$result = mysql_query
("SELECT * FROM daphp_counter");
while ($row = mysql_fetch_array ($result)) {
$view=$row[1];
$klick=$row[0];
$tab_date=$row[4];
$gesamt=$row[3];
}
$view_new=$view+1;
if($tab_date==$actuell_date){}
else{
$gestern=$view;
$gesamt=$gesamt+$view;
mysql_query("UPDATE daphp_counter SET
time='$actuell_date',view='0',gesamt='$gesamt',gestern='$gestern'");
mysql_query("TRUNCATE TABLE daphp_count_ip");
}
$result = mysql_query
("SELECT * FROM daphp_count_ip");
while ($row = mysql_fetch_array ($result)) {
if($ip==$row[1]){$insert_ip=true;}
}
if($insert_ip==true){}
else{
$time_stamp=date("d.m.Y");
mysql_query
("INSERT INTO daphp_count_ip (ip,time) VALUES ('$ip','$time_stamp')");
mysql_query
("UPDATE daphp_counter SET view='$view_new'");
}
$klick=$klick+1;
mysql_query("UPDATE daphp_counter SET klick='$klick'");
$result = mysql_query("SELECT * FROM daphp_counter");
while ($row = mysql_fetch_array ($result)) {
$new_view=$row[1];
$new_klicks=$row[0];
$new_gestern=$row[2];
$new_gesamt=$row[3];
}
?>
So, (r)umgebrochen ...
Kommentar