View Single Post
  #48  
Old 07-06-2007, 03:46 PM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: IP Addresses in Users Online for all users

I integrated this mod into my 4.0.19 site today. Working wonderfully.

A few notes...

When you first upload the 3 mod files, you may have some empty IP fields at first, from the visitor's that were already on your site. As new visitors enter and move around all the empty IP fields will become filled in, so this symptom is short lived, but may mislead some to think the mod isn't working when they first install it.


---
In Auth.php:

$session_ip = getenv('REMOTE_ADDR');
or
$session_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];

Both of the above seemed to work fine on my site, for now, I'm sticking with the first one.


---
Stats.php:

My site code was a bit different for the 2nd mod in this file, but it worked fine by inserting it at the end of this section of code (just above $statistics[] = $rec):

Code:
$rec['current_date'] = $data['current_date']+$config["General"]["timezone_offset"]; $rec['current_url_page'] = $data['current_url_page']; $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"]; # NOTE - add session_ip line below... $rec['session_ip'] = $data['session_ip']; $statistics[] = $rec;

---
Stats.tpl:

In this file, I wanted the visitor's IP address to be displayed on a new line, just below where it typically says, "Unregistered customer", so I added a Break as follows:

Code:
<TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}<A href="user_modify.php?user={$v.userinfo.login|escape:"url"}&usertype=C">{$v.userinfo.firstname} {$v.userinfo.lastname}</A>{if $v.userinfo.status eq 'A'}<BR><I>({$lng.lbl_anonymous_customer})</I>{/if}{else}{$lng.lbl_unregistered_customer}{/if} {* NOTE - Add site visitor IP address to Statistics - Users Online page via line below *} <BR>IP: {$v.session_ip} </TD>

Hamid, Thanks for this helpful mod!

Robert
__________________
X-cart 4.1.10
Reply With Quote