View Single Post
  #120  
Old 12-27-2013, 10:26 AM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,964
 

Default Re: IP Addresses in Users Online for all users

I have it working now in 4.6.1 using an edited version of post 105 by Mish and the edit done by denlem in 106. Below is the code that I'm using.

In postauth.php
PHP Code:
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'] : "");

    
$current_date XC_TIME;

    if (empty(
$session_create_date)) {
        
$session_create_date $current_date;
    }

    
$session_ip getenv('REMOTE_ADDR');


In modules/Users_online/stats.php
PHP Code:
$rec['session_create_date'] = $data['session_create_date'] + $config["Appearance"]["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

In skin/common_files/modules/Users_online/stats.tpl (denlem edit)
Replace
Code:
<td bgcolor="#FFFFFF" nowrap="nowrap" valign="top">{if $v.userinfo ne ''}<a href="{$catalogs.admin}/user_modify.php?user={$v.userinfo.id}&amp;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}</td>

With
Code:
<td bgcolor="#FFFFFF" nowrap="nowrap" valign="top">{if $v.userinfo ne ''}<a href="{$catalogs.admin}/user_modify.php?user={$v.userinfo.id}&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}</br>IP: <a href="http://cqcounter.com/whois/?query={$v.session_ip}" target="_blank">{$v.session_ip}</a> </td>

The only change I made was to comment out some of the added PHP code in stats.php. With that change it's working fine for me. Somebody else can play with the other PHP code if they want.
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote