View Single Post
  #1  
Old 09-13-2005, 02:45 PM
 
hamid hamid is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 107
 

Default IP Addresses in Users Online for all users

With this mod you can see the IP Address of all users (including "Unregistered User") in the Users Online page.

I've only tested this mod with v4.0.14, but it should work just as well in 4.0.x.

It's really easy to implement this modification, but remember to backup your files before you make any changes.

What the following changes do is:

1. Creates a new entry in session data called session_ip
2. Saves users IP address in session_ip
3. Calls session_ip data in the .tpl file

You have to change 3 files:

1. auth.php
2. xcart>modules>Users_online>stats.php
3. xcart>skin1>modules>Users_online>stats.tpl

On (or around) line 64 in auth.php look for:


Code:
*********************************************** if(!empty($active_modules['Users_online'])) { x_session_register("current_url_page"); x_session_register("current_date"); x_session_register("session_create_date"); $current_url_page = $php_url['url'].($php_url['query_string']?"?".$php_url['query_string']:""); if(empty($session_create_date)) $session_create_date = time(); $current_date = time(); } *********************************************** And change it to: *********************************************** if(!empty($active_modules['Users_online'])) { x_session_register("session_ip"); x_session_register("current_url_page"); x_session_register("current_date"); x_session_register("session_create_date"); $current_url_page = $php_url['url'].($php_url['query_string']?"?".$php_url['query_string']:""); if(empty($session_create_date)) $session_create_date = time(); $current_date = time(); $session_ip = getenv('REMOTE_ADDR'); } ***********************************************

Then on line 50 in xcart>modules>Users_online>stats.php look for:

Code:
*********************************************** $vars = array("login", "login_type", "cart", "current_date", "current_url_page", "session_create_date"); *********************************************** And change it to: *********************************************** $vars = array("login", "login_type", "cart", "current_date", "current_url_page", "session_create_date", "session_ip"); ***********************************************

In the same file (stats.php), look for the following on line 94:

Code:
*********************************************** $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"]; $statistics[] = $rec; *********************************************** And change it to: *********************************************** $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"]; $rec['session_ip'] = $data['session_ip']; $statistics[] = $rec; ***********************************************

And finally you have to put "IP: {$v.session_ip}" into xcart>skin1>modules>Users_online>stats.tpl

On line 20 look for:

Code:
*********************************************** <TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.firstname}{if $v.userinfo.status eq 'A'} ({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if}</TD> *********************************************** And change it to: *********************************************** <TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.firstname}{if $v.userinfo.status eq 'A'}({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if} IP: {$v.session_ip}</TD> ***********************************************

That's all the changes done, now go to the Users Online section [in Admin>Statistics>Users Online] and the IP Address of customers currently on your site should appear underneath their names.

If you reload your Users Online page at regular intervals you can watch how your customers navigate your site.
Reply With Quote