"; echo ""; echo "STATSolved"; // echo ""; echo ""; echo ""; echo ""; ## 2.0 ################################################################## //------------------------------ Staten -------------------------------- /* Script ? by www.usolved.net */ /* Optimizations and modifications by www.deixu.net */ $strarr = Array('directly_entered'=>'Direkte Eingabe'); $get_time=mysql_query("SELECT ipsperre_time,useronline_time FROM {$prefix}_settings"); $aus_time=mysql_fetch_object($get_time); /* User Daten auslesen */ $user_agent=$_SERVER['HTTP_USER_AGENT']; $httpreferer=$_SERVER['HTTP_REFERER']; $request_uri=$_SERVER['REQUEST_URI']; $ip_v=$_SERVER['REMOTE_ADDR']; $accept_language=$_SERVER['HTTP_ACCEPT_LANGUAGE']; $hostmark=@gethostbyaddr($REMOTE_ADDR); $timestamp=time(); $time_v=time(); $reload_v=$aus_time->ipsperre_time; //zeit der ip sperre in minuten, default 60 $reload_useronline=$aus_time->useronline_time; //zeit der user online anzeige in minuten, default 4 $timedel_useronline=$time_v-($reload_useronline*60); $timedel_v=$time_v-($reload_v*60); $timedel_d=$time_v-($reload_v*2880); $t_date=date("Y-m-d"); $a_hour=date("H",time()); // current hour in the 0-23 format $a_hour="h".$a_hour; /* Clean the Database */ mysql_query("DELETE FROM {$prefix}_ipsperre WHERE time<='{$timedel_d}'"); mysql_query("DELETE FROM {$prefix}_recentusers WHERE timestamp<='{$timedel_d}'"); /* IP Check */ $get_ip_check=mysql_query("SELECT id FROM {$prefix}_ipsperre WHERE ip='{$ip_v}' AND time>='{$timedel_v}'"); $ip_check_rows = mysql_num_rows($get_ip_check); /* Counter */ $get_daycheck=mysql_query("SELECT id,date FROM {$prefix}_counter ORDER BY id DESC"); $aus_daycheck=mysql_fetch_object($get_daycheck); $d_date=$aus_daycheck->date; if($d_date!=$t_date) { $get_dateexxists = mysql_query("SELECT id FROM {$prefix}_counter WHERE date='{$t_date}'"); if(mysql_num_rows($get_dateexxists) == 0) { mysql_query("INSERT INTO {$prefix}_counter (date,counts,hits,{$a_hour}) VALUES ('{$t_date}','1','1','1')"); } } /* Maximum hits per day */ $get_maxinsert=mysql_query("SELECT id FROM {$prefix}_counter_other"); if(mysql_num_rows($get_maxinsert)==0) { mysql_query("INSERT INTO {$prefix}_counter_other (counts_max,hits_max) VALUES ('1','1')"); } else { $register_max="ok"; } /* Check what should be updated */ if(mysql_num_rows(mysql_query("SELECT * FROM {$prefix}_exclude WHERE exclusion='{$ip_v}' AND flag_ref='i'"))==0) { if($ip_check_rows==0) { /* Counter */ if($d_date==$t_date) { mysql_query("UPDATE {$prefix}_counter SET counts=counts+1,hits=hits+1,{$a_hour}={$a_hour}+1 WHERE id='$aus_daycheck->id'"); } /* Browser */ mysql_query("UPDATE {$prefix}_browser SET hits=hits+1 WHERE LOCATE(LOWER(browser1), LOWER('{$user_agent}')) LIMIT 1"); /* Operating System */ mysql_query("UPDATE {$prefix}_os SET hits=hits+1 WHERE LOCATE(os1, '{$user_agent}') LIMIT 1"); /* Language */ mysql_query("UPDATE {$prefix}_language SET hits=hits+1 WHERE IF(language1='{$accept_language}', language1='{$accept_language}', language1='') LIMIT 1"); /* Referer */ /***********/ $current_url = $_SERVER['HTTP_HOST']; if($httpreferer) { $referer['complete'] = $_SERVER['HTTP_REFERER']; $referer['parsed'] = parse_url($_SERVER['HTTP_REFERER']); } else { $referer['parsed']['host'] = $referer['complete'] = $strarr['directly_entered']; } /* Host Referer */ $get_exc_r=mysql_query("SELECT exclusion FROM $prefix"."_exclude WHERE flag_ref='r'"); if(mysql_num_rows($get_exc_r)!=0) { while($aus_exc_r=mysql_fetch_object($get_exc_r)) { if(strstr($referer['parsed']['host'],$aus_exc_r->exclusion)==false) { $result = mysql_query("UPDATE {$prefix}_referer SET hits=hits+1 WHERE referer='" . $referer['parsed']['host'] . "'"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_referer (referer,hits) VALUES ('" . $referer['parsed']['host'] . "','1');"); } } } } else { $result = mysql_query("UPDATE {$prefix}_referer SET hits=hits+1 WHERE referer='" . $referer['parsed']['host'] . "';"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_referer (referer,hits) VALUES ('" . $referer['parsed']['host'] . "','1');"); } } /* Complete referer */ $get_exc_c=mysql_query("SELECT exclusion FROM $prefix"."_exclude WHERE flag_ref='c'"); if(mysql_num_rows($get_exc_c)!=0) { while($aus_exc_c=mysql_fetch_object($get_exc_c)) { if(strstr($referer['complete'],$aus_exc_c->exclusion)==false) { $result = mysql_query("UPDATE {$prefix}_referer_c SET hits=hits+1 WHERE referer_c='" . $referer['complete'] . "' AND '". $current_url . "' NOT LIKE referer_c;"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_referer_c (referer_c,hits) VALUES ('" . $referer['complete'] . "','1');"); } } } } else { $result = mysql_query("UPDATE {$prefix}_referer_c SET hits=hits+1 WHERE referer_c='" . $referer['complete'] . "' AND '". $current_url . "' NOT LIKE referer_c;"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_referer_c (referer_c,hits) VALUES ('" . $referer['complete'] . "','1');"); } } /* Internal Referer */ if($request_uri) { $get_exc_o=mysql_query("SELECT exclusion FROM $prefix"."_exclude WHERE flag_ref='c'"); if(mysql_num_rows($get_exc_o)!=0) { while($aus_exc_o=mysql_fetch_object($get_exc_o)) { if(strstr($request_uri,$aus_exc_o->exclusion)==false) { $result = mysql_query("UPDATE {$prefix}_referer_own SET hits=hits+1 WHERE referer_own='" . $request_uri . "';"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_referer_own (referer_own,hits) VALUES ('" . $request_uri . "','1');"); } } } } else { $result = mysql_query("UPDATE {$prefix}_referer_own SET hits=hits+1 WHERE referer_own='" . $request_uri . "';"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_referer_own (referer_own,hits) VALUES ('" . $request_uri . "','1');"); } } } /* Searchwords */ if($httpreferer) { $searchwords=$referer['complete']; if(strstr($referer['complete'], "?q=")==true || strstr($referer['complete'], "&q=")==true) { $searchwords_item = 'q='; $searchwords_len = 2; $found = true; } elseif(!$found && (strstr($referer['complete'], "?p=")==true || strstr($referer['complete'], "&p=")==true)) { $searchwords_item = 'p='; $searchwords_len = 2; $found = true; } elseif(!$found && (strstr($referer['complete'], "?su=")==true || strstr($referer['complete'], "&su=")==true)) { $searchwords_item = 'su='; $searchwords_len = 3; $found = true; } elseif(!$found && (strstr($referer['complete'], "?query=")==true || strstr($referer['complete'], "&query=")==true)) { $searchwords_item = 'query='; $searchwords_len = 6; $found = true; } if($found) { $searchwords_pos=strpos($referer['complete'], $searchwords_item); $searchwords=substr($referer['complete'], $searchwords_pos + $searchwords_len); $searchwords_pos=strpos($searchwords, "&"); $searchwords=substr($searchwords, 0, $searchwords_pos); $search = Array('+', '%22', '%2B', '+-', '+OR+'); $replace = Array(' ', '"', '+', '-', ' OR '); $searchwords = str_replace($search, $replace, $searchwords); $result = mysql_query("UPDATE {$prefix}_searchwords SET hits=hits+1 WHERE searchwords='" . $searchwords . "';"); if(mysql_affected_rows() == 0) { mysql_query("INSERT INTO {$prefix}_searchwords (searchwords_site,searchwords,hits) VALUES ('" . $referer['parsed']['host'] . "','" . $searchwords . "','1');"); } } } /* Resolution, Depth */ ?> id'"); } } /* Max Counts/Hits */ if($register_max=="ok") { $get_max=mysql_query("SELECT counts_max,hits_max FROM $prefix"."_counter_other"); $aus_max=mysql_fetch_object($get_max); $get_maxid=mysql_query("SELECT max(id) AS maxid FROM $prefix"."_counter"); $aus_maxid=mysql_fetch_object($get_maxid); $maxid=$aus_maxid->maxid; $get_latest=mysql_query("SELECT * FROM $prefix"."_counter WHERE id='$maxid'"); $aus_latest=mysql_fetch_object($get_latest); $db_counts=$aus_latest->counts; $db_hits=$aus_latest->hits; if($db_counts>$aus_max->counts_max) { mysql_query("UPDATE $prefix"."_counter_other SET counts_max=counts_max+1"); } if($db_hits>$aus_max->hits_max) { mysql_query("UPDATE $prefix"."_counter_other SET hits_max=hits_max+1"); } } /* User */ $result = mysql_query("UPDATE {$prefix}_recentusers SET timestamp='{$timestamp}' WHERE user_ip='{$ip_v}';"); if(mysql_affected_rows() == 0) { $r_date=date("Y-m-d H:i:s"); /* IP Check */ $get_ip_check=mysql_query("SELECT * FROM {$prefix}_recentusers WHERE user_ip='{$ip_v}'"); if(mysql_num_rows($get_ip_check)==0) { mysql_query("INSERT INTO {$prefix}_recentusers (user_agent,user_hostmark,user_ip,timestamp,date) VALUES ('{$user_agent}','{$hostmark}','{$ip_v}','{$timestamp}','{$r_date}');"); } } } //IP Exclude ## 1.0 ################################################################## //----------------------------- Ausgabe -------------------------------- $heute_date=date("Y-m-d"); $gestern_timestamp=time()-86400; $gestern_date=date("Y-m-d",$gestern_timestamp); $vgestern_timestamp=time()-86400*2; $vgestern_date=date("Y-m-d",$vgestern_timestamp); $get_settings=mysql_query("SELECT * FROM $prefix"."_settings"); $aus_settings=mysql_fetch_object($get_settings); /* Stats zusenden */ if($aus_settings->send_stats==1) { $datum_gestern=time()-86400; $datum_gestern=date("Y-m-d",$datum_gestern); $get_sendcheck=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$datum_gestern' AND sent_stats='0'"); if(mysql_num_rows($get_sendcheck)==true) { $aus_sendcheck=mysql_fetch_object($get_sendcheck); $zieladdi=$aus_settings->send_stats_to; $subject="Stats - ".$datum_gestern; $message=" Die Stats von: ".$datum_gestern.": ----------------------------------------- Counts gesamt: ".$aus_sendcheck->counts." Hits gesamt: ".$aus_sendcheck->hits." Stundenauflistung: 24 Uhr - 01 Uhr: ".$aus_sendcheck->h00." 01 Uhr - 02 Uhr: ".$aus_sendcheck->h01." 02 Uhr - 03 Uhr: ".$aus_sendcheck->h02." 03 Uhr - 04 Uhr: ".$aus_sendcheck->h03." 04 Uhr - 05 Uhr: ".$aus_sendcheck->h04." 05 Uhr - 06 Uhr: ".$aus_sendcheck->h05." 06 Uhr - 07 Uhr: ".$aus_sendcheck->h06." 07 Uhr - 08 Uhr: ".$aus_sendcheck->h07." 08 Uhr - 09 Uhr: ".$aus_sendcheck->h08." 09 Uhr - 10 Uhr: ".$aus_sendcheck->h09." 10 Uhr - 11 Uhr: ".$aus_sendcheck->h10." 11 Uhr - 12 Uhr: ".$aus_sendcheck->h11." 12 Uhr - 13 Uhr: ".$aus_sendcheck->h12." 13 Uhr - 14 Uhr: ".$aus_sendcheck->h13." 14 Uhr - 15 Uhr: ".$aus_sendcheck->h14." 15 Uhr - 16 Uhr: ".$aus_sendcheck->h15." 16 Uhr - 17 Uhr: ".$aus_sendcheck->h16." 17 Uhr - 18 Uhr: ".$aus_sendcheck->h17." 18 Uhr - 19 Uhr: ".$aus_sendcheck->h18." 19 Uhr - 20 Uhr: ".$aus_sendcheck->h19." 20 Uhr - 21 Uhr: ".$aus_sendcheck->h20." 21 Uhr - 22 Uhr: ".$aus_sendcheck->h21." 22 Uhr - 23 Uhr: ".$aus_sendcheck->h22." 23 Uhr - 24 Uhr: ".$aus_sendcheck->h23." "; $header="From: STATSolved"; @mail($zieladdi, $subject, $message, $header); mysql_query("UPDATE $prefix"."_counter SET sent_stats='1' WHERE date='$datum_gestern'"); } } ############################################################ $get_layout=mysql_query("SELECT * FROM $prefix"."_layout"); $aus_layout=mysql_fetch_object($get_layout); echo "table_bgcolor."\" background=\"".$aus_layout->table_background."\">"; echo ""; echo "
table_width."\" style=\"padding-left:2\">"; echo ""; $get_order_h=mysql_query("SELECT order_show FROM $prefix"."_settings_order WHERE id='1'"); $aus_order_h=mysql_fetch_object($get_order_h); if($aus_order_h->order_show=="1") { // echo ""; echo ""; } $get_order=mysql_query("SELECT * FROM $prefix"."_settings_order ORDER by order_number"); while($aus_order=mysql_fetch_object($get_order)) { $get_visible=mysql_query("SELECT * FROM $prefix"."_settings_order WHERE id='$aus_order->id' AND id<>'1'"); $aus_visible=mysql_fetch_object($get_visible); if($aus_visible->order_show=="1") { echo ""; } } echo ""; if($aus_settings->show_statistics=="1") { // echo ""; } // echo ""; echo "
font_face.";font-size:".$aus_layout->font_size."pt;color:".$aus_layout->font_color.";\">Statistik:
font_face.";font-size:".$aus_layout->font_size."pt;color:".$aus_layout->font_color.";\">". $aus_visible->order_name .": font_face.";font-size:".$aus_layout->font_size."pt;color:".$aus_layout->font_color.";\">"; ############## User Online ###################################### if($aus_visible->id=="2") { if($aus_visible->order_show=="1") { $u_limit=time()-$aus_settings->useronline_time*60; $get_user_online=mysql_query("SELECT count(id) AS u_online FROM $prefix"."_recentusers WHERE timestamp>'$u_limit'"); $aus_user_online=mysql_fetch_object($get_user_online); $u_online=$aus_user_online->u_online; } echo "$u_online"; } ############## Counts gesamt ###################################### if($aus_visible->id=="3") { $get_counts_g=mysql_query("SELECT sum(counts) AS counts_g FROM $prefix"."_counter"); $aus_counts_g=mysql_fetch_object($get_counts_g); $counts_gesamt=$aus_counts_g->counts_g+$aus_settings->edit_gcounts; echo "$counts_gesamt"; } ############## Counts Schnitt ###################################### if($aus_visible->id=="4") { $get_counts_avg=mysql_query("SELECT avg(counts) AS counts_avg FROM $prefix"."_counter"); if(mysql_num_rows($get_counts_avg)!=0) { $aus_counts_avg=mysql_fetch_object($get_counts_avg); $counts_avg=$aus_counts_avg->counts_avg; $counts_avg=sprintf("%.0f", $counts_avg); } else { $counts_avg="0"; } echo "$counts_avg"; } ############## Counts Max. ###################################### if($aus_visible->id=="5") { $get_maxstats=mysql_query("SELECT counts_max FROM $prefix"."_counter_other"); if(mysql_num_rows($get_maxstats)!=0) { $aus_maxstats=mysql_fetch_object($get_maxstats); $counts_max=$aus_maxstats->counts_max; } else { $counts_max="0"; } echo "$counts_max"; } ############## Counts Heute ###################################### if($aus_visible->id=="6") { $get_date_heute=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$heute_date'"); if(mysql_num_rows($get_date_heute)!=0) { $aus_date_heute=mysql_fetch_object($get_date_heute); $counts_h=$aus_date_heute->counts; } else { $counts_h=0; } echo "$counts_h"; } ############## Counts Gestern ###################################### if($aus_visible->id=="7") { $get_date_gestern=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$gestern_date'"); if(mysql_num_rows($get_date_gestern)!=0) { $aus_date_gestern=mysql_fetch_object($get_date_gestern); $counts_g=$aus_date_gestern->counts; } else { $counts_g=0; } echo "$counts_g"; } ############## Counts Vorgestern ###################################### if($aus_visible->id=="8") { $get_date_vgestern=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$vgestern_date'"); if(mysql_num_rows($get_date_vgestern)!=0) { $aus_date_vgestern=mysql_fetch_object($get_date_vgestern); $counts_vg=$aus_date_vgestern->counts; } else { $counts_vg=0; } echo "$counts_vg"; } ############## Hits gesamt ###################################### if($aus_visible->id=="9") { $get_hits_g=mysql_query("SELECT sum(hits) AS hits_g FROM $prefix"."_counter"); $aus_hits_g=mysql_fetch_object($get_hits_g); $hits_gesamt=$aus_hits_g->hits_g+$aus_settings->edit_ghits; echo "$hits_gesamt"; } ############## Hits Schnitt ###################################### if($aus_visible->id=="10") { $get_hits_avg=mysql_query("SELECT avg(hits) AS hits_avg FROM $prefix"."_counter"); if(mysql_num_rows($get_hits_avg)!=0) { $aus_hits_avg=mysql_fetch_object($get_hits_avg); $hits_avg=$aus_hits_avg->hits_avg; $hits_avg=sprintf("%.0f", $hits_avg); } else { $hits_avg="0"; } echo "$hits_avg"; } ############## Hits Max. ###################################### if($aus_visible->id=="11") { $get_maxstats=mysql_query("SELECT hits_max FROM $prefix"."_counter_other"); if(mysql_num_rows($get_maxstats)!=0) { $aus_maxstats=mysql_fetch_object($get_maxstats); $hits_max=$aus_maxstats->hits_max; } else { $hits_max="0"; } echo "$hits_max"; } ############## Hits Heute ###################################### if($aus_visible->id=="12") { $get_date_heute=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$heute_date'"); if(mysql_num_rows($get_date_heute)!=0) { $aus_date_heute=mysql_fetch_object($get_date_heute); $hits_h=$aus_date_heute->hits; } else { $hits_h=0; } echo "$hits_h"; } ############## Hits Gestern ###################################### if($aus_visible->id=="13") { $get_date_gestern=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$gestern_date'"); if(mysql_num_rows($get_date_gestern)!=0) { $aus_date_gestern=mysql_fetch_object($get_date_gestern); $hits_g=$aus_date_gestern->hits; } else { $hits_g=0; } echo "$hits_g"; } ############## Hits Vorgestern ###################################### if($aus_visible->id=="14") { $get_date_vgestern=mysql_query("SELECT * FROM $prefix"."_counter WHERE date='$vgestern_date'"); if(mysql_num_rows($get_date_vgestern)!=0) { $aus_date_vgestern=mysql_fetch_object($get_date_vgestern); $hits_vg=$aus_date_vgestern->hits; } else { $hits_vg=0; } echo "$hits_vg"; } echo "
font_face."; font-size:".$aus_layout->font_size."pt; color:".$aus_layout->font_color.";\">» font_face."; font-size:".$aus_layout->font_size."pt; color:".$aus_layout->font_color.";\">Statistik
font_face."; font-size:".$aus_layout->font_size."pt; color:".$aus_layout->font_color.";\">© font_face."; font-size:".$aus_layout->font_size."pt; color:".$aus_layout->font_color.";\">usolved.net
"; ########################################################################## echo ""; echo ""; ?>