Visitor Web Stats
for osCommerce Online Merchant v2.2
This is the latest version of Visitor Web Stats by Ian-San. The only difference in this version is I've cleaned out all of the hotlinked images, stylesheets, and tracking code that he placed in the readme.html, version.html, and admin/visitors.php files so that this contribution is now compliant with the rules.
All credit goes to Ian-San for making one of the most popular and most utilized OSC contributions around.
Legend: 
Download

Report
Minor mod. If you find your store running slow due to lots of visitors, try these DB mods
ALTER TABLE `visitors` ADD INDEX ( `customers_id` ) ;
ALTER TABLE `visitors_trace` ADD INDEX ( `browser_ip` ) ;
Covers only visitors.php, no images for buttons.
class Geoip was called 2 times : admin/visitors.php, and admin/includes/graph/visitor_infobox.php
so I simply commented the call in visitor_infobox.php and now it's possible to get the graph for the IP (report=13)
Only visitor_infobox.php is include in the zip
* Added almost all flags in a nice layout
* Fixed a little problem with the display of the LAN icon with a small IF routine
Included updates 3.1.1 and 3.1.2. Added ability to auto delete stats in visitors.php after a certain time period. So your system doesn't get bogged down if you forget to delete the stats for a couple of months.
FULL VERSION
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
* Display of country flags now fully available
* Fix minor repetition language bugs (english and french)
* New french translation updated
* New SQL file with french translation
* New background colors for better display/look
* Only english and french languages stored in this pack
This is full package.
Enjoy !
Fixed a small bug where if you go from a yearly view to "One Month" you would get a mysql error since no month was specified. It now uses the current month if no month was specified through the dropdown.
Only included visitors.php
thanks goes to Phocea for the fix.
only one file (admin/visitors.php)
changed some define in french
fixed the pbe of geo.inc already called when using flags ( thanks phocea !)
added missing define in language : define('IMAGE_EMPTY', 'Delete all'); (add yourself for other than english and french language)
moved to admin all configuration ( gd, cookies, flag etc ...) and also choice of colors
* Spiders are now detected using the standard Osc Session Spider
* Added option to display Customers IP originating Country Flag
Only a few changes from latest release:
* Added option to show Visitor Hosts Name under IP
* Added option to display Customers traces ONLY
* Added possibility to exclude several IP address from the stats (in visitor_count.php)
* Warning: Localised key have only been done in french and english. See Install Notes for details
For more information see install.html
If you only want to do a quick upgrade simply copy over the includes/visitors_count.php, admin/visitors.php and add new localisation key to your visitor.php language file (see install.html for list of keys)
This is the latest version of Visitor Web Stats by Ian-San. The only difference in this version is I've cleaned out all of the hotlinked images, stylesheets, and tracking code that he placed in the readme.html, version.html, and admin/visitors.php files so that this contribution is now compliant with the rules.
All credit goes to Ian-San for making one of the most popular and most utilized OSC contributions around.