X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   IP Addresses in Users Online for all users (https://forum.x-cart.com/showthread.php?t=16571)

steve.thompson 11-03-2011 01:36 PM

Re: IP Addresses in Users Online for all users
 
Quote:

Originally Posted by qualiteam
I've attached the "IP Addresses in Users Online for all users" mod patch for 4.4.x.


I've applied this patch to a clean unmodified 4.4.2 installation. I get the following error:
Quote:

skin/common_files/modules/Users_online/stats.tpl Could not patch
modules/Users_online/stats.php OK
postauth.php Could not patch


cflsystems 11-03-2011 08:03 PM

Re: IP Addresses in Users Online for all users
 
This is not an error. It means XC cannot auto patch the files, you need to do this manually

steve.thompson 11-03-2011 10:27 PM

Re: IP Addresses in Users Online for all users
 
But this was on a clean, unmodified 4.4.2 install. If the patch won't apply, there's a problem with the patch or the patch software.

Edit: I did a manual patch. There was no reason that the patch should have failed on the first and third file and the patch was incorrectly applied on the second file. Manually patched it now works ok.

qualiteam 11-08-2011 02:32 AM

Re: IP Addresses in Users Online for all users
 
In 4.4.4 the patch is applied without any problems.

Probably there were some updates in the patching system since 4.4.2...

Mish 08-03-2012 03:45 PM

Re: IP Addresses in Users Online for all users
 
Hi Folks,
I've manually changed Version 4.4.5 to display IP Addresses / domain lookup for users online:
  1. Edit PostAuth.php line 97
Change

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'] : "");

    $current_date = XC_TIME;

    if (empty($session_create_date)) {

        $session_create_date = $current_date;

    }

}


to

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');   
       
}




Open Xcart -> Modules -> Users_online->stats.php

Edit line 104 and change

Code:

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


to

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;


Open x-cart -> skin1 -> Modules -> Users_online->stats.tpl
(Note, on my site I had to use X-cart ->Skin instead of skin1)
Edit line 23
Change it from

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>
 

to


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} IP: {$v.session_ip} <a href="http://cqcounter.com/whois/?query={$v.session_ip}" target="_blank">Trace Location</a>  </td>
 



Here is a screen shot:
http://mojoimage.com/free-image-hosting-11/3523Screen-Shot-2012-08-06-at-3-26-39-PM.pngFree Image Hosting

denlem 08-13-2012 04:12 PM

Re: IP Addresses in Users Online for all users
 
I just installed this update 4.5.2 and it works there also.

The only difference is the section below is in a slightly different location and can be found in:

X-Cart/skin/common_files/modules/Users_online/stats.tpl

Quote:

Originally Posted by Mish


Open x-cart -> skin1 -> Modules -> Users_online->stats.tpl
(Note, on my site I had to use X-cart ->Skin instead of skin1)
Edit line 23
Change it from

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>
 

to


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} IP: {$v.session_ip} <a href="http://cqcounter.com/whois/?query={$v.session_ip}" target="_blank">Trace Location</a>  </td>
 





I also edited the change to the following:

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>


This cleans it up a bit and puts the "IP: " on it's own line, and the Trace Location link is dropped and the IP is clickable instead.

http://backwoodstattoos.com/images/P/ip.png

GreatLakesVacuum 03-07-2013 06:43 AM

Re: IP Addresses in Users Online for all users
 
Will this still work on 4.5.4? Do I just need to do what is in posts 105 and 106? Sometimes these old threads where people add on to and modify the code are tough to stumble upon later because you don't know how far back you have to start reading.

elmirage001 03-07-2013 07:28 AM

Re: IP Addresses in Users Online for all users
 
It's not working on my 4.5.5 dev site. {$v.session_ip} does not have a value. It's on my list to look at but may be above my pay grade :-)

elmirage001 03-08-2013 05:40 PM

Re: IP Addresses in Users Online for all users
 
For 4.5.5 (not tested in other versions)

I used the Smarty function {$smarty.server.REMOTE_ADDR} so I don't need to make any changes to postauth.php or stats.php anymore.

In store/skin/common_files/modules/Users_online/stats.tpl

Change From:
Quote:

<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>
To:
Quote:

<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}<br />IP: <a href="http://cqcounter.com/whois/?query={$smarty.server.REMOTE_ADDR}" target="_blank">{$smarty.server.REMOTE_ADDR}</a> </td>

imexhouse 04-22-2013 05:19 PM

Re: IP Addresses in Users Online for all users
 
I use IP2Location service, and when I make the change suggested,

Code:

IP: <a href="http://www.ip2location.com/{$v.session_ip}" target="_blank">{$v.session_ip}</a></td>

changed to

Code:

IP: <a href="http://www.ip2location.com/{$smarty.server.REMOTE_ADDR}" target="_blank">{$smarty.server.REMOTE_ADDR}</a></td>

it always shows MY ip address, instead of the user's IP address.
Am I missing something?


All times are GMT -8. The time now is 09:40 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.