//Written by Matt Toigo
//SETTINGS
$SETTINGS = array();
$SETTINGS['exclude'] = array();
//Name of directory that MEC Stats is running in NO SLASHES
$SETTINGS['dir_name'] = 'webstats1';
//Time offset default 0,0
//Uncomment the line below to see the current time on your server
//echo(date('H:i A'));
//Used to compensate for a difference in your timezone and your servers timezone
//Use + and negative integers
//If the displayed times are one hour fast then set $SETTINGS['offset_hours'] to -1
//If the displayed times are one hour slow then set $SETTINGS['offset_hours'] to 1
$SETTINGS['offset_hours'] = 0;
$SETTINGS['offset_minutes'] = 0;
//Name of logfile - default log.txt
$SETTINGS['logfile'] = 'log.txt';
//Number of visitors to display in latest visitors
$SETTINGS['latest'] = 300;
//Exclude pages with the follwing patterns in the url from Page Rankings
//Useful if you have a search or forums on your site and don't want all searches/pages to appear as ranked pages
//Copy the line below, remove the two slashes, replace 'term' with text found in a url that you wouldn't want to show up.
//$SETTINGS['exclude'][] = 'term';
//Number of pages to display on Page Rankings - default 100
$SETTINGS['ranked_pages'] = 100;
//Number of domains to display on refferers page - default 100
$SETTINGS['ref_num'] = 100;
//Admin IP
//This is your ip address, if you don't want the stats to count you when you visit your site enter your IP address
$SETTINGS['admin_ip'] = '62.1.55.153';
//86.127.4.17
//Trends Scale
//Used to set the width for the trends graphs - default 350
$SETTINGS['trend_scale'] = 350;
//Browser/OS Scale
//Used to set the width for the browser and os graphs - default 300
$SETTINGS['brow_os_scale'] = 300;
//Refferer Scale
//Used to set the width for the refferer graph - default 300
$SETTINGS['ref_scale'] = 300;
//Search Scale
//Used to set the width for the search graphs
$SETTINGS['search_scale'] = 300;
//ARCHIVE SETTINGS
//Automatically Archive Log Files, default = TRUE;
$SETTINGS['auto_archive'] = TRUE;
//Auto Archive Size Limit, default 500000
$SETTINGS['archive_limit'] = 1000000;
//Number of refferers to archive, default = top 500
$SETTINGS['ref_arch_ammount'] = 500;
?>
Ελληνική Εταιρία Διαχειρίσεως Ακινήτων ΑΕ
//Written by Matt Toigo
require_once('settings.inc');
$doc_root = '';
//Create new timestamp compensating for difference in timezone, takes 0000-00-00 00:00:00
function new_stamp($stamp, $hours, $minutes)
{
$new = date('Y-m-d H:i:s', mktime(date('H', strtotime($stamp))+$hours,date('i', strtotime($stamp))+$minutes,date('s', strtotime($stamp)),date('n', strtotime($stamp)),date('j', strtotime($stamp)),date('Y', strtotime($stamp))));
return $new;
}
//Finds graph multiplier
function find_mp($data, $scale)
{
//Finds highest value
$high_val = 0;
foreach($data as $ele)
if($ele>$high_val)
$high_val = $ele;
if($high_val>0)
$mp = ($scale-15)/$high_val;
else
$mp = 0;
return $mp;
}
//Get base domain of refferer
function get_ref_domain($ref)
{
$x = FALSE;
$length = strlen($ref);
if(!preg_match("/$_SERVER[SERVER_NAME]/", $ref))
{
if(preg_match('/http:\/\//', $ref))
$x = substr($ref, 7, $length);
if(preg_match('/http:\/\/www./', $ref))
$x = substr($ref, 11, $length);
if(preg_match('/\//', $x))
$end = strpos($x, '/');
else
$end = strlen($x);
$x = substr($x, 0, $end);
}
return $x;
}
//Exclude urls
function exclude($page, $exclude)
{
$x = TRUE;
foreach($exclude as $ele)
if(preg_match("/$ele/i", $page))
$x = FALSE;
return $x;
}
//Finds the highest value in an array
function find_high($data)
{
$high_value = 0;
foreach($data as $ele)
{
if($ele > $high_value)
$high_value = $ele;
}
return $high_value;
}
//Rules for finding browser/os
require_once('agent_defs.inc');
function find_browser($agent, $browser_def)
{
$browser = 'Other';
foreach($browser_def as $key=>$ele)
if(preg_match("/$ele/i", $agent))
$browser = $key;
if($agent=='')
$browser = 'Unknown';
return $browser;
}
function find_os($agent, $os_def)
{
$os = 'Other';
foreach($os_def as $key=>$ele)
if(preg_match("/$ele/i", $agent))
$os = $key;
if($agent=='')
$os = 'Unknown';
return $os;
}
function find_robot($agent, $se_def)
{
$robot = FALSE;
foreach($se_def as $key=>$ele)
if($ele->check_bot($agent))
$robot = $ele->name;
return $robot;
}
function find_se($ref, $se_def)
{
$se = FALSE;
foreach($se_def as $key=>$ele)
if($ele->check_ref($ref))
$se = $ele->name;
return $se;
}
//Finds a search query
function find_query($se_name, $ref, $se_def)
{
$query = '';
$query = $se_def[$se_name]->check_query($ref);
return $query;
}
//SEARCH ENGINE CLASS, STORES ALL DATA FOR A PARTICULAR SEARCH ENGINE
class SE {
var $name;
var $agent_pattern;
var $url;
var $bot_url;
var $ss_start;
var $ref_pattern;
//Assigns Values
function SE($x_name, $x_agent_pattern, $x_ref_pattern, $x_url, $x_bot_url, $x_ss_start)
{
$this->name = $x_name;
$this->agent_pattern = $x_agent_pattern;
$this->ref_pattern = $x_ref_pattern;
$this->url = $x_url;
$this->bot_url = $x_bot_url;
$this->ss_start = $x_ss_start;
}
//Checks for this search engines bot
function check_bot($agent)
{
if($this->agent_pattern!='')
if(preg_match("/$this->agent_pattern/i", $agent))
return $this->name;
else
return FALSE;
}
//Checks for search engine referal
function check_ref($ref)
{
if($this->ref_pattern!='')
if(preg_match("/$this->ref_pattern/i", $ref))
return $this->name;
else
return FALSE;
}
//Get query - revise and shorten logic
function check_query($ref)
{
$query = FALSE;
if($this->ss_start!='' && preg_match("/$this->ss_start/i", $ref))
{
$start = strpos($ref, $this->ss_start)+strlen($this->ss_start);
//Find next &
$next_param = strlen($ref); //end of url if no &
for($c=$start+1;$c