View Single Post
  #95  
Old 06-16-2011, 12:06 AM
  Mish's Avatar 
Mish Mish is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 92
 

Exclamation Re: IP Addresses in Users Online for all users

G'day,

I modified the code to resolve the hostname (from the IP address) instead of having a hyperlink to resolve it. Give it a try:

Follow the steps previously provided.

Then do the following:

Then on or around line 94 in xcart>modules>Users_online>stats.php look for you recently changed code:




Code:

***********************************************

$rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"];
$rec['session_ip'] = $data['session_ip'];
$statistics[] = $rec;

***********************************************

and change it to

***********************************************
$rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"];
if (!empty($data['session_ip']))
{
if ($HTTP_SERVER_VARS['REMOTE_ADDR'] != $data['session_ip'])
$rec['session_ip'] = gethostbyaddr($data['session_ip']);
else
$rec['session_ip'] = "Admin";
}
else
$rec['session_ip'] = $data['session_ip'];
$statistics[] = $rec;
***********************************************

This will:
If it can resolve the IP Address, it will and replace the IP address with the hostname.
If it was from your IP address it will replace it with ADMIN.
If it cannot resolve, it will leave the IP address there.


Here is an example from my site:

Unregistered customer IP: Admin
Unregistered customer IP: static-208-80-194-33.as13448.com

Please note if your first line in that code looks like:

$rec['session_create_date'] = $data['session_create_date']+$config["Appearance"]["timezone_offset"];

then keep it that way!
__________________
X-Cart Gold 4.6.1
Reply With Quote