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)

shopccp 06-08-2007 12:13 PM

Re: IP Addresses in Users Online for all users
 
Your mod does not work on my site either. I configured all three files...no ip in users online. I'm using xcart 4.1.7.

This mod now works on my site. After I posted the above message, refresh all browser and ftp content...minutes later the ip address shows up in users online. I noticed my ip address is not listed in user online stats when I'm connected to the homepage. Its a little wierd, but at least other ip addresses shows up.


Justin

Quote:

Originally Posted by hamid
Hi 2019

It's a shame that it's not working for you - but if you have followed the instructions above and you are running 4.0.14 (although it probably works on any 4.0.x), then I really don't know why it's not working without seeing your code.

This was the first mod I've posted, so to be honest I dont know if it works on anyone elses system. It works on mine, so in theory it should work with others too.

I'm not an expert, but in order to try to make it work you could try the following:

1. Some servers have a problem with the 'getenv' function, so in my modification of auth.php, change

$session_ip = getenv('REMOTE_ADDR');

to:

$session_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];

Then upload the ammended file and see if the IP addresses appear in your Users Online page.

To be honest, I think it's generally accepted that it's better practice to use $HTTP_SERVER_VARS rather than getenv anyway

If anyone else has tried this mod... did it work?


anandat 06-09-2007 09:35 PM

Re: IP Addresses in Users Online for all users
 
Hello,
Now any one can please paste the perfect working code here which tested in 4.1.7 also.

keystone 06-15-2007 08:57 AM

Re: IP Addresses in Users Online for all users
 
Hi,
I have changed my code and my users online stats are showing ip addresses but can someone explain this? All the IP addresses shown are the same. What is going on? I have between 40 and 60 unregistered users shown but all have the same IP address. The First entry and Last entry are always the same time as eachother.

Customer Date Current page Cart content
First entry Last entry
Unregistered customer IP: 38.99.44.106 15-06-2007
11:48:11 15-06-2007
11:48:11 .../home.php?cat=10&sort=title&sort_direction=0&page=2 5
Unregistered customer IP: 38.99.44.106 15-06-2007
11:48:20 15-06-2007
11:48:20 .../product.php?printable=Y&productid=2423&cat=12&page =7
Unregistered customer IP: 38.99.44.106 15-06-2007
11:49:09 15-06-2007
11:49:09 .../product.php?printable=Y&productid=3426&cat=9&page= 4&js=n
Unregistered customer IP: 38.99.44.106 15-06-2007
11:11:07 15-06-2007
11:11:07 .../product.php?productid=2415&js=y
Unregistered customer IP: 38.99.44.106 15-06-2007
11:08:52 15-06-2007
11:08:52 .../product.php?printable=Y&productid=673
Unregistered customer IP: 38.99.44.106 15-06-2007
11:08:26 15-06-2007
11:08:26 .../product.php?productid=196&cat=8&page=1&js=n
Unregistered customer IP: 38.99.44.106 15-06-2007
11:09:08 15-06-2007
11:09:08 .../product.php?printable=Y&productid=3425
Unregistered customer IP: 38.99.44.106 15-06-2007
11:30:38 15-06-2007
11:30:38 .../product.php?printable=Y&productid=4805
Unregistered customer IP: 38.99.44.106 15-06-2007
11:30:58 15-06-2007
11:30:58 .../product.php?productid=140&cat=8&page=5
Unregistered customer IP: 38.99.44.106 15-06-2007
11:31:04 15-06-2007
11:31:04 .../product.php?productid=10815&js=n
Unregistered customer IP: 38.99.44.106 15-06-2007
11:27:14 15-06-2007
11:27:14 .../product.php?productid=6611&js=y
Unregistered customer IP: 38.99.44.106 15-06-2007
11:27:54 15-06-2007
11:27:54 .../product.php?productid=3005&cat=12&page=2&js=y
Unregistered customer IP: 38.99.44.106 15-06-2007
11:05:57 15-06-2007
11:05:57 .../product.php?productid=810&js=y
Unregistered customer IP: 38.99.44.106 15-06-2007
10:52:28 15-06-2007
10:52:28 .../product.php?printable=Y&productid=11507&cat=17&pag e=1
Unregistered customer IP: 38.99.44.106 15-06-2007
10:53:07 15-06-2007
10:53:07 .../product.php?productid=4427&cat=7&page=10&js=y

anandat 06-16-2007 06:21 PM

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

Originally Posted by keystone
Hi,
I have changed my code and my users online stats are showing ip addresses but can someone explain this? All the IP addresses shown are the same. What is going on?


Don't worry...it sems the bots are crawling your site & I have marked that for some reason they like to crwal "printable page" more as its pure HTML.

ACS 06-22-2007 07:15 PM

4.1.6 IP address online
 
Apologise in advance if i am not posting right, first time.
I found a thread on modifiying xcart so you can see user IP addresses online. This thread is quite old and for an earlier version.

http://forum.x-cart.com/showthread.php?t=16571&highlight=ip+addresses+onli ne

I have x-cart version 4.1.6 and the files are different and being such a novice I can't work out which ones to change. The x-cart guys want 60 points to modify this for me. can anyone out there update the above thread to newer versions of x-cart? I would really apreciate your help.

carpeperdiem 06-22-2007 07:48 PM

Re: 4.1.6 IP address online
 
The mod you linked to works fine in 4.1.6, 4.1.7 and 4.1.8

You should not start a new thread... I am appending this to the thread you are linking to.

carpeperdiem 06-22-2007 08:05 PM

Re: IP Addresses in Users Online for all users
 
PS -- post#1 works in 4.1.x -- but be careful -- the first line of the php code should have a space after the if, like this:

Code:

if(!empty($active_modules['Users_online'])) {

also, in the template, respect xhtml conventions.

robertswww 07-06-2007 03:46 PM

Re: IP Addresses in Users Online for all users
 
I integrated this mod into my 4.0.19 site today. Working wonderfully.

A few notes...

When you first upload the 3 mod files, you may have some empty IP fields at first, from the visitor's that were already on your site. As new visitors enter and move around all the empty IP fields will become filled in, so this symptom is short lived, but may mislead some to think the mod isn't working when they first install it.


---
In Auth.php:

$session_ip = getenv('REMOTE_ADDR');
or
$session_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];

Both of the above seemed to work fine on my site, for now, I'm sticking with the first one.


---
Stats.php:

My site code was a bit different for the 2nd mod in this file, but it worked fine by inserting it at the end of this section of code (just above $statistics[] = $rec):

Code:

                $rec['current_date'] = $data['current_date']+$config["General"]["timezone_offset"];
                $rec['current_url_page'] = $data['current_url_page'];
                $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"];
# NOTE - add session_ip line below...
                $rec['session_ip'] = $data['session_ip'];
                $statistics[] = $rec;


---
Stats.tpl:

In this file, I wanted the visitor's IP address to be displayed on a new line, just below where it typically says, "Unregistered customer", so I added a Break as follows:

Code:

        <TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}<A href="user_modify.php?user={$v.userinfo.login|escape:"url"}&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}
        {* NOTE - Add site visitor IP address to Statistics - Users Online page via line below *}
        <BR>IP: {$v.session_ip}
        </TD>


Hamid, Thanks for this helpful mod!

Robert

jchopick 07-07-2007 07:34 AM

Re: IP Addresses in Users Online for all users
 
Hamid,

Thank you for this mod it works great. I made the small change of

$session_ip = getenv('REMOTE_ADDR');
to
$session_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];

and it does what I was looking to do. Thanks again....

Jeff

Paul H 07-13-2007 09:26 AM

Re: IP Addresses in Users Online for all users
 
I have this mod working on my site but it just displays the persons first name twice
and it would be better having the user name displayed-did i do something wrong here?


All times are GMT -8. The time now is 12:42 AM.

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