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 > Changing and adding new features
 
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,383
 

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 Gold v4.6.6 PHP 5.6 (live)
X-Cart Gold v4.7.10 PHP 7.2 (in development)
  • XCARTMODS.CO.UK | reBOOT Template |
  • Smack Digital | CDSEO Pro 2.0 + Custom Replacements | Category SEO Map |
  • CODECANYON | Dynamic Website Compressor |
  • Total Server Solutions Hosting | Linux | PHP v 5.6.37 | MySQL v5.6.40 |
Reply With Quote
  #123  
Old 12-02-2016, 01:24 AM
 
josebueso josebueso is offline
 

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

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
 

Member
  
Join Date: Aug 2012
Posts: 28
 

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.6.3
Previous: 4.0.14 GOLD
Reply With Quote

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

X-Guru
  
Join Date: Nov 2002
Location: UK
Posts: 3,518
 

Default Re: IP Addresses in Users Online for all users

If you've followed the above and managed to get the IP addresses of users online, here's an easy way of getting more data about them.

It'll show country name and country flag, which if you click, it'll toggle more info

I've only tested with a light number of users online. Not sure how it'll perform with hundreds.


Attached Files
File Type: zip users_online_more_info_mod.zip (76.6 KB, 22 views)
__________________
xcartmods.co.uk


Reply With Quote

The following 2 users thank PhilJ for this useful post:
cherie (10-23-2018), elmirage001 (10-22-2018)
  #126  
Old 10-22-2018, 12:47 PM
 
elmirage001 elmirage001 is offline
 

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

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 Gold v4.6.6 PHP 5.6 (live)
X-Cart Gold v4.7.10 PHP 7.2 (in development)
  • XCARTMODS.CO.UK | reBOOT Template |
  • Smack Digital | CDSEO Pro 2.0 + Custom Replacements | Category SEO Map |
  • CODECANYON | Dynamic Website Compressor |
  • Total Server Solutions Hosting | Linux | PHP v 5.6.37 | MySQL v5.6.40 |
Reply With Quote
  #127  
Old 10-23-2018, 03:46 PM
 
elmirage001 elmirage001 is offline
 

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

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 Gold v4.6.6 PHP 5.6 (live)
X-Cart Gold v4.7.10 PHP 7.2 (in development)
  • XCARTMODS.CO.UK | reBOOT Template |
  • Smack Digital | CDSEO Pro 2.0 + Custom Replacements | Category SEO Map |
  • CODECANYON | Dynamic Website Compressor |
  • Total Server Solutions Hosting | Linux | PHP v 5.6.37 | MySQL v5.6.40 |
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:16 AM.

   

 
X-Cart forums © 2001-2018