reftime; if($refcheck->ip) { $update = "UPDATE ref SET zeit = '$zeit' WHERE `ip` = '$ip'"; mysql_query($update) or die ( mysql_error() ); } if(!$refcheck->ip) { $eintragen = "INSERT INTO `ref` SET `ip` = '$ip', `ref` = '$ref', zeit = '$zeit'"; mysql_query($eintragen) or die ( mysql_error() ); } elseif(!$refcheck->ref) { $eintragen = "UPDATE `ref` SET `ip` = '$ip', `ref` = '$ref' WHERE ip = '$ip' LIMIT 1"; mysql_query($eintragen) or die ( mysql_error() ); } //alte löschen $refcheck = mysql_fetch_object(mysql_query("SELECT zeit,id FROM ref WHERE ip != 'xxx.xxx.xxx.xxx' ORDER BY id DESC LIMIT 5,1")); if($zeit - 3600 > $refcheck->zeit) { $eintragen = "UPDATE `ref` SET `ip` = 'xxx.xxx.xxx.xxx' WHERE id = '$refcheck->id'"; mysql_query($eintragen) or die ( mysql_error() ); } //besuchercounter $besuchersumme = mysql_num_rows(mysql_query("SELECT * FROM ref")); $later_24h = $zeit - 86400; $besucherlast24h = mysql_num_rows(mysql_query("SELECT zeit FROM ref WHERE zeit > '$later_24h'")); $later_10m = $zeit - 1800; $besucheronline = mysql_num_rows(mysql_query("SELECT zeit FROM ref WHERE zeit > '$later_10m'")); $later_60m = $zeit - 10000; $besucheronline_c = mysql_num_rows(mysql_query("SELECT zeit FROM ref WHERE zeit > '$later_60m'")); // //logoutcheck $logoutcheck = mysql_fetch_object(mysql_query("SELECT lastaktion,kdnr,status FROM kunden WHERE session > '0' ORDER BY lastaktion ASC")); $time = $logoutcheck->lastaktion; $wandel = mktime(substr($time,8,2),substr($time,10,2),substr($time,12,2),substr($time,4,2),substr($time,6,2),substr($time,0,4)); $jetzt = time(); if($jetzt - 1800 > $wandel && $logoutcheck->status == "2") { $eintragen = "UPDATE `kunden` SET `ip` = '', `session` = '' WHERE `kdnr` = '$logoutcheck->kdnr'"; mysql_query($eintragen) or die ( mysql_error() ); } // if(!$session || strlen($session) < "10" || strlen($session) > "10" ) { $session = strtolower(substr(md5(microtime()),0,10)); } //prüfen ob die session shcon inner db ist, falls ja und andere ip wird neue vergeben $checksession = mysql_fetch_object(mysql_query("SELECT session,ip FROM kunden WHERE session = '$session' ORDER BY lastaktion DESC LIMIT 1")); if($checksession->session === $session && $checksession->ip != $ip) { $session = strtolower(substr(md5(microtime()),0,10)); } // include 'head.php'; include 'main.php'; include 'food.php'; ?>