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
  #101  
Old 11-03-2011, 01:36 PM
 
steve.thompson steve.thompson is offline
 

eXpert
  
Join Date: Feb 2009
Location: Sydney, Australia
Posts: 302
 

Default 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
__________________
X-Cart Gold 4.2.1 / 4.4.2
X-AOM, X-SpecialOffers
Download Expander 2.1.3 / 2.2.0
Reply With Quote
  #102  
Old 11-03-2011, 08:03 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,189
 

Default 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 Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #103  
Old 11-03-2011, 10:27 PM
 
steve.thompson steve.thompson is offline
 

eXpert
  
Join Date: Feb 2009
Location: Sydney, Australia
Posts: 302
 

Default 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.
__________________
X-Cart Gold 4.2.1 / 4.4.2
X-AOM, X-SpecialOffers
Download Expander 2.1.3 / 2.2.0
Reply With Quote
  #104  
Old 11-08-2011, 02:32 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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...
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following 2 users thank qualiteam for this useful post:
carpeperdiem (11-20-2011), steve.thompson (11-08-2011)
  #105  
Old 08-03-2012, 03:45 PM
  Mish's Avatar 
Mish Mish is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 92
 

Default 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
__________________
X-Cart Gold 4.6.1
Reply With Quote

The following 2 users thank Mish for this useful post:
CB Tan (01-08-2016), photo (08-04-2012)
  #106  
Old 08-13-2012, 04:12 PM
  denlem's Avatar 
denlem denlem is offline
 

Senior Member
  
Join Date: Apr 2004
Location: MA / CT / RI Border
Posts: 117
 

Default 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
__________________
X-Cart Gold Plus 4.7.10
Reply With Quote

The following user thanks denlem for this useful post:
carpeperdiem (01-15-2013)
  #107  
Old 03-07-2013, 06:43 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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.
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #108  
Old 03-07-2013, 07:28 AM
 
elmirage001 elmirage001 is offline
 

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

Default 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
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #109  
Old 03-08-2013, 05:40 PM
 
elmirage001 elmirage001 is offline
 

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

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

The following 2 users thank elmirage001 for this useful post:
christindall (03-13-2013), MythNReality (07-11-2013)
  #110  
Old 04-22-2013, 05:19 PM
  imexhouse's Avatar 
imexhouse imexhouse is offline
 

eXpert
  
Join Date: May 2006
Location: Canada
Posts: 377
 

Default 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?
__________________
Jack@AquasanaCA
X-CART GOLD 4.0.19 Live
DSEFU, AOM, ezCheckout, ezUpsell, ezRecommends, RememberMe, RememberAnonCarts
AquasanaCanada.com - Aquasana╝ - #1 Rated Water Filters in America!
X-CART GOLD 4.4.5 Live
CDSEO Pro v. 1.8.4
AquasanaMontreal.com
Aquasana╝ & Rhino Water Filtration Systems
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


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 02:22 AM.

   

 
X-Cart forums © 2001-2020