Location: PHPKode > projects > Modular Site Manager > htdocs/ndstats/stat_calc.php3
<?
//////////////////////////////////////////////////////
//            NDStats - PHP Site stats              //
//               2004 Alan Briolat                 //
// See http://www.net-dezigns.com/ for more details //
///////////////////////////////////////////////////

	$dir = SITE_PATH.'/ndstats/';
	$filedata = file($dir."stats.txt");
	$data = explode('|~|',$filedata[0]);
	$today_hits = $data[0];
	$total_hits = $data[1];
	$unique_hits = $data[2];
	$file_date = $data[3];
	$last_day = $data[4];
	
	$today = date('Ymd');
	if($file_date != $today){
		$last_day = $today_hits;
		$today_hits = 0;
	}
	$page_hits = $page_hits + 1;
	if(!session_is_registered('statlogged')){
		if(empty($times_visited)){
			$unique_hits = $unique_hits + 1;
		}
		$total_hits = $total_hits + 1;
		$today_hits = $today_hits + 1;
		session_register('statlogged');
	}

	$fp = fopen($dir."stats.txt","w");
	$string = $today_hits.'|~|'.$total_hits.'|~|'.$unique_hits.'|~|'.$today.'|~|'.$last_day;
	fwrite($fp,$string);
	fclose($fp);
?>
Return current item: Modular Site Manager