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)

mikeb0208@gmail.com 11-27-2016 07:35 AM

Re: IP Addresses in Users Online for all users
 
Does anyone have this working for 4.7.6?? I used to have it in 4.4.2 but seems like some of the code does not have the same places as before. Not a programmer here and would love to be able to see this function so I know when I have a bot hitting my store. Used to work great ! Thanks for the help!

elmirage001 11-28-2016 07:57 AM

Re: IP Addresses in Users Online for all users
 
The changes I made for 4.6.x are not working in 4.7.x <--Wrong, it does work.

I'll take a look after the Christmas rush. Thanks for catching!

Paul


EDIT - Code is working in 4.7.10

josebueso 12-02-2016 01:24 AM

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

Originally Posted by elmirage001
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.


Hello

I just installed this mode on xcart 4.7.6 and works without issues so far.
Thanks

Saul

CB Tan 12-21-2016 10:11 AM

Re: IP Addresses in Users Online for all users
 
Your changes are working fine in 4.7.6.
The coding may have some variations between versions but it should be working.
I deleted the<a href="http://cqcounter.com/whois/?query={$v.session_ip}" target="_blank">

elmirage001 10-22-2018 12:47 PM

Re: IP Addresses in Users Online for all users
 
Hi Phil !!

I'm testing 4.7.10 now and I'll add in a few days.

Thank you very much!

Paul

elmirage001 10-23-2018 03:46 PM

Re: IP Addresses in Users Online for all users
 
Hi Phil,

Works great in 4.7.10 PHP 7.2 - Thank you so much!

Looking forward to reBOOT reDUX !!

Paul


All times are GMT -8. The time now is 05:30 PM.

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