PDA

View Full Version : Visitor Web Stats



michael_s
06-23-2007, 05:15 AM
To make it show the correct time, simply find all occureneces of now() in /catalog/includes/visitors_count.php to:
date_add(now(), INTERVAL " . TIME_ZONE_OFFSET . " HOUR)

===============================
To make this contribution properly work with register global off, do the following:



Find

if ($referer == '') {
$referer = $HTTP_SERVER_VARS['HTTP_REFERER'];
}

Change to

if ($referer == '') {
// $referer = $HTTP_SERVER_VARS['HTTP_REFERER'];
$referer = $_SERVER['HTTP_REFERER'];
}

Find

$uri = sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI);

Change to

//$uri = sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI);
$uri = sprintf("%s%s%s","http://",$_SERVER['HTTP_HOST'],$_SERVER['REQUEST_URI']);

Find

if ( function_exists('tep_get_ip_address') ) {
$b_ip = tep_get_ip_address();
} else {
$b_ip = getenv('REMOTE_ADDR');
}

Change to

if (isset($_SERVER)) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$test = explode(".",$_SERVER['HTTP_X_FORWARDED_FOR']);
if (
($test[0] == '127')
|| ($test[0] == '192' && $test[1] == '168')
|| ($test[0] == '172' && (int)$test[1] > 15 && (int)$test[1] < 32)
|| ($test[0] == '10')
|| ($test[0] == '169' && $test[1] == '254')
)
{
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
} else {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
} else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$test = explode(".",$_SERVER['HTTP_X_FORWARDED_FOR']);
if (
($test[0] == '127')
|| ($test[0] == '192' && $test[1] == '168')
|| ($test[0] == '172' && (int)$test[1] > 15 && (int)$test[1] < 32)
|| ($test[0] == '10')
|| ($test[0] == '169' && $test[1] == '254')
)
{
if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
} else {
$ip = getenv('REMOTE_ADDR');
}
} else {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
} elseif (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
} else {
$ip = getenv('REMOTE_ADDR');
}
}
$b_ip = $ip;


Also in the visitors.php file

Find

default:
$order = str_replace('AND', 'WHERE', $robot) . $guest_only ." order by ";
break;
}

Change to

default:
$order = str_replace('AND', 'WHERE', $robot) . $guest_only ." order by ";
break;
}


$listing = $HTTP_GET_VARS['listing'];
============================

All credits for the register globals fix go to mataphore_e
Please IGNORE attached file, it doesn't contain anything

More... (http://www.oscommerce.com/community/contributions,4067)