$session_expire) { session_destroy(); echo "Connection timed out! $lang_general[7]"; echo "

"; } else { $session_time = $new_session_time; session_register('session_time'); if ($is_loged_in == "1") { $action(); } else { echo "$lang_general[6]
\n $lang_general[7]"; echo "
"; } } } else {*/ $action(); //} } } class file_edit { function get_main_log() { $current_month = date("n"); $current_day = date("j"); $current_year = date("Y"); $logg_val=array(); global $logg_val,$show; $logg = file("logs/stats.txt"); if(!isset($show) || $show == "all") { $logg_val = array_reverse($logg); } elseif($show=="today") { foreach($logg as $logline) { $logg_arr=explode("|",$logline); if($logg_arr[1]==$current_day && $logg_arr[2]==$current_month && $logg_arr[3]==$current_year){ $logg_val[] = $logline; } } $logg_val = array_reverse($logg_val); } elseif($show=="month") { foreach($logg as $logline) { $logg_arr=explode("|",$logline); if($logg_arr[2]==$current_month && $logg_arr[3]==$current_year){ $logg_val[] = $logline; } } $logg_val = array_reverse($logg_val); } } } class main_log { function get_last_hosts($to_print) { global $logg_val; $log = new file_edit; $log->get_main_log(); $printed="0"; foreach($logg_val as $logline){ $logg_data = explode("|", $logline); if($printed < $to_print) { echo"$logg_data[8]
\n"; $printed++; } } } // end get_last_hosts function get_reffering_sites($to_print) { global $logg_val, $server_url; $log = new file_edit; $log->get_main_log(); $all_sites = array(); $daily_all_sites = array(); $monthly_all_sites = array(); $total_hits=0; $daily_total=0; $monthly_total=0; $current_month = date("n"); $current_day = date("j"); $current_year = date("Y"); foreach($logg_val as $logline) { $logg_data = explode("|", $logline); if (stristr($logg_data[4], "$server_url") === false) { $slashes=0; $url_arr=explode("/", $logg_data[4]); if(isset($url_arr[2])){ $total_hits++; if(!isset($all_sites[$url_arr[2]])) { $all_sites[$url_arr[2]]=1; } else { $all_sites[$url_arr[2]]++; } if($logg_data[2] == $current_month && $logg_data[3] == $current_year) { $monthly_total++; if(!isset($monthly_all_sites[$url_arr[2]])) { $monthly_all_sites[$url_arr[2]]=1; } else { $monthly_all_sites[$url_arr[2]]++; } if($logg_data[1] == $current_day) { $daily_total++; if(!isset($daily_all_sites[$url_arr[2]])) { $daily_all_sites[$url_arr[2]]=1; } else { $daily_all_sites[$url_arr[2]]++; } } } } } } if($total_hits==0){ $total_hits=1; } if($daily_total==0) { $daily_total=1; } if($monthly_total==0) { $monthly_total=1; } echo""; natsort($all_sites); $all_sites = array_reverse($all_sites); $printed=0; while (list ($site, $hits) = each ($all_sites)) { if($printed < 10) { $width=$hits/$total_hits*100*3; $monthly_width=$monthly_all_sites[$site]/$monthly_total*100*3; $daily_width=$daily_all_sites[$site]/$daily_total*100*3; echo"\n"; } $printed++; } echo"
$siteT $hits
M $monthly_all_sites[$site]
D $daily_all_sites[$site]
  

"; } // end get reffering sites } class show_stuff { function show_display_what($action,$select_nm){ global $lang_general; echo"\n"; if($select_nm == 1) { echo"
Display top: \n"; echo"
\n"; } echo"$lang_general[8]\n"; echo"\n"; echo""; echo"
"; } } ## start gen_monthly_log function gen_monthly_log() { $all_years = array(); $all_stats = file ("logs/stats.txt"); while (list ($key, $val) = each ($all_stats)) { $tosplit = "|"; $contarr = explode($tosplit,$val); $hour = $contarr[0]; $day = $contarr[1]; $month = $contarr[2]; $year = $contarr[3]; $reffer = $contarr[4]; $browser = $contarr[5]; $vistors_ip = $contarr[6]; $is_uniqe = $contarr[9]; $is_uniqe = trim ($is_uniqe); if(!isset($all_years[$year])) { $all_years[$year]="$year"; } } $monthly_log = fopen("logs/monthly.log", "a+"); foreach($all_years as $year) { fwrite($monthly_log,"$year"); $months=array(1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,9=>0,10=>0,11=>0,12=>0); foreach($all_stats as $line){ $ncontarr = explode("|",$line); if($ncontarr[3] == $year) { $months[$ncontarr[2]]++; } } foreach($months as $mhits) { fwrite($monthly_log,"|$mhits"); } } fwrite($monthly_log,"\n"); fclose($monthly_log); } ## slutt _gen_monthly_log function showMenuItem($title, $link) { echo"\n"; echo"\n"; echo"\n"; echo"\n"; echo"

$title

\n"; echo"\n"; } ?> You are not allowed to run x-stat from here!
->Visit the x-stat forums for more info.