Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

IP Addresses in Users Online for all users

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #121  
Old 11-27-2016, 07:35 AM
 
mikeb0208@gmail.com mikeb0208@gmail.com is offline
 

Member
  
Join Date: Nov 2016
Posts: 18
 

Default 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!
__________________
4.7
stock
Reply With Quote
  #122  
Old 11-28-2016, 07:57 AM
 
elmirage001 elmirage001 is offline
 

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

Default 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
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #123  
Old 12-02-2016, 01:24 AM
 
josebueso josebueso is offline
 

eXpert
  
Join Date: Apr 2006
Location: USA
Posts: 371
 

Default 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
__________________
Saul
x-cart 4.7.9 Gold Plus

www.uncionmusic.com
Reply With Quote

The following 2 users thank josebueso for this useful post:
CB Tan (12-21-2016), elmirage001 (12-22-2016)
  #124  
Old 12-21-2016, 10:11 AM
 
CB Tan CB Tan is offline
 

Advanced Member
  
Join Date: Aug 2012
Posts: 37
 

Default 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">
__________________
X-Cart DB Version:Migrated to 4.7.9
Reply With Quote

The following user thanks CB Tan for this useful post:
elmirage001 (12-22-2016)
  #125  
Old 10-22-2018, 12:47 PM
 
elmirage001 elmirage001 is offline
 

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

Default 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
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #126  
Old 10-23-2018, 03:46 PM
 
elmirage001 elmirage001 is offline
 

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

Default 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
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:54 PM.

   

 
X-Cart forums © 2001-2020