= "5"){ if ($_SERVER["HTTP_CLIENT_IP"]){ $sc_ip = $_SERVER["HTTP_CLIENT_IP"]; } else { $sc_ip = $_SERVER["REMOTE_ADDR"]; } }elseif(phpversion() >= "4.1.0"){ if ($_ENV["HTTP_CLIENT_IP"]){ $sc_ip = $_ENV["HTTP_CLIENT_IP"]; } else { $sc_ip = $_ENV["REMOTE_ADDR"]; } }elseif(phpversion() < "4.1.0" || $sc_ip == ""){ if(GETENV(HTTP_CLIENT_IP)){ $sc_ip = getenv(HTTP_CLIENT_IP); } else { $sc_ip = getenv(REMOTE_ADDR); } } ## daten eingabe ## verfallne daten loeschen $con=con("DELETE FROM counter_data WHERE time<='".($sc_zeit-5184000)."' OR time>'".($sc_zeit+100)."' OR ip=''"); ## wird eine ip uebermittelt? if(ereg ("(^[0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}$)",$sc_ip)){ ## ip in den letzten 24h schonmal da gewesen? $sc_ip_check = mysql_num_rows(con("SELECT id FROM counter_data WHERE ip='$sc_ip' && date='".date("Y-m-d", $sc_zeit )."'")); } else { $sc_ip_check=1; } ## schreibe wenn ip noch nicht innerhalb von 24h vorhanden ist if($sc_ip_check==0){ ## schreibe neuen counterstand if(mysql_num_rows(con("SELECT visits FROM counter_max"))==0){ $con=con("INSERT INTO counter_max (visits_all) VALUES ('1') "); }else{ $con=con("SELECT visits_all FROM counter_max"); if($con<>"0" and $con<>"Err"){ $sc_counterstand_old = mysql_result($con,0,0); } $con=con("UPDATE counter_max SET visits_all='".($sc_counterstand_old+1)."'"); } ## schreibe neue user daten $con=con("INSERT INTO counter_data (ip, time, date, client, host, referer) VALUES ('$sc_ip', '$sc_zeit', '".date("Y-m-d",$sc_zeit)."', '".$HTTP_USER_AGENT."', '".gethostbyaddr($sc_ip)."', '$HTTP_REFERER') "); ## max visits check $sc_max_visits_new = mysql_num_rows(con("SELECT date FROM counter_data WHERE date='".date("Y-m-d",$sc_zeit)."'")); $sc_max_visits_old = mysql_result(con("SELECT visits FROM counter_max"),0,0); if($sc_max_visits_new > $sc_max_visits_old){ $con=con("UPDATE counter_max SET visits='$sc_max_visits_new'"); } ## max user online check $sc_max_user_new = mysql_num_rows(con("SELECT date FROM counter_data WHERE time>'".(time()+$sc_zeitverschiebung-$sc_verfall)."'")); $sc_max_user_old = mysql_result(con("SELECT user FROM counter_max"),0,0); if($sc_max_user_new > $sc_max_user_old){ $con=con("UPDATE counter_max SET user='$sc_max_user_new'"); } } else { ## update der vorhandenen daten $con=con("UPDATE counter_data SET time='$sc_zeit', date='".date("Y-m-d", $sc_zeit)."' WHERE ip='$sc_ip' && date='".date("Y-m-d", $sc_zeit)."'"); } ## daten ausgabe ## variablen $sc_max_visits = mysql_result(con(" SELECT visits FROM counter_max"),0,0); $sc_max_user = mysql_result(con(" SELECT user FROM counter_max"),0,0); $sc_user_online = mysql_num_rows(con("SELECT id FROM counter_data WHERE time>'".($sc_zeit-$sc_verfall)."'")); $sc_lastday = mysql_num_rows(con("SELECT id FROM counter_data WHERE date='".date("Y-m-d", $sc_zeit-86400)."'")); $sc_visits = mysql_num_rows(con("SELECT id FROM counter_data WHERE date='".date("Y-m-d",$sc_zeit)."'")); $sc_visits_all = mysql_result(con(" SELECT visits_all FROM counter_max"),0,0); ## einzelne php ausgabe if($sc_show == "visits"){ echo $sc_visits; } elseif ($sc_show == "last_day"){ echo $sc_lastday; } elseif ($sc_show == "user_online"){ echo $sc_user_online; } elseif ($sc_show == "max_user_online"){ echo $sc_max_user; } elseif ($sc_show == "max_visits"){ echo $sc_max_visits; } elseif ($sc_show == "visits_all"){ echo $sc_visits_all; } elseif(!isset($sc_java) && !isset($sc_invisible)){ echo str_replace( array("{VISITS}","{LAST_DAY}","{USER_ONLINE}","{MAX_USER_ONLINE}","{MAX_VISITS}","{VISITS_ALL}"), array($sc_visits,$sc_lastday,$sc_user_online,$sc_max_user,$sc_max_visits,$sc_visits_all), $sc_counter_layout); } ## java ausgabe if($sc_java == "visits"){ echo ("document.write('$sc_visits');"); } elseif ($sc_java == "last_day"){ echo ("document.write('$sc_lastday');"); } elseif ($sc_java == "user_online"){ echo ("document.write('$sc_user_online');"); } elseif ($sc_java == "max_user_online"){ echo ("document.write('$sc_max_user');"); } elseif ($sc_java == "max_visits"){ echo ("document.write('$sc_max_visits');"); } elseif ($sc_java == "visits_all"){ echo ("document.write('$sc_visits_all');"); } elseif(isset($sc_java) && !isset($sc_invisible)){ for ($ii=0; $ii < strlen($sc_counter_layout); $ii++){ if ($sc_counter_layout[$ii]!=chr(13)) { $sc_counter_layout[$ii]=="\n" ? $sc_counter_layout_rs .= " " : $sc_counter_layout_rs .= $sc_counter_layout[$ii]; } } echo ("document.write('"); echo str_replace( array("{VISITS}","{LAST_DAY}","{USER_ONLINE}","{MAX_USER_ONLINE}","{MAX_VISITS}","{VISITS_ALL}"), array($sc_visits,$sc_lastday,$sc_user_online,$sc_max_user,$sc_max_visits,$sc_visits_all), $sc_counter_layout_rs); echo ("');"); } ?>