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?

anandat 07-13-2007 10:38 PM

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

Originally Posted by Paul H
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?


in stats.tpl file

find

<TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.firstname}{if $v.userinfo.status eq 'A'}
({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if}</TD>

And replace it with:

<TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.lastname}{if $v.userinfo.status eq 'A'}
({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if}</TD>


I guess above should resolve this problem.

Paul H 07-15-2007 01:25 AM

Re: IP Addresses in Users Online for all users
 
Yes that worked !

and for a shot in the dark I also tried adding
{$v.userinfo.username}

but that didn't work

MythNReality 03-22-2008 06:16 PM

Re: IP Addresses in Users Online for all users
 
post#1 works with XCart 4-1-9! Sweet~

MythNReality 05-09-2008 11:12 PM

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

To MythNReality: the code in auth.php is there in v4.0.9, so it should be there in 4.0.12 as well. Just search for 'Users_online' in your copy of auth.php - there is only one instance of it in the whole of the file, so the code you are looking for should be right there (unless you've modified your auth.php and somehow gotten rid of it - if you have an unmodified copy of auth.php do a search in that and see if it's there).

I hope this helps!
Thank you. Hamid. I found it and got it works now. ;-)

circleofatlantis 06-06-2008 01:34 AM

Re: IP Addresses in Users Online for all users
 
I've made the changes to the php's ok.

But in the tpl, the line of code is completely different from the one quoted in the OP to look for.

Quote:

<td bgcolor="#FFFFFF" nowrap="nowrap" valign="top">{if $v.userinfo ne ''}<a href="user_modify.php?user={$v.userinfo.login|esca pe:"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}</td>


Has there been an update that this mod has not taken into account since the last post on this thread ?

Suggestions ? I dont like the idea of just replacing it, without knowing why the code is different.

circleofatlantis 06-07-2008 12:52 AM

Re: IP Addresses in Users Online for all users
 
Ok, took the plunge and just added the IP bit to the existing line.

Seems to work fine. And I added the line break as well :)

Next question :

How does one modify this to only display 1 line per IP ?

Edit : I got the click on IP working to, thanks whoever suggested the 2 add-ons. :)

I'm finding the results a bit odd.

All the IP's are the same, and yet the user environments are all different. If it was the same IP address, why isnt the environment list showing all the same ?

Personally, I dont want to know that 1 user is on and has visited 61 pages in the last however long. I want to know how many genuine users are online now and where they actually are now.

Can anyone suggest some modifications to achieve this ?

hamid 06-18-2008 02:46 AM

Re: IP Addresses in Users Online for all users
 
hi circleofatlantis

Each time a user opens a new window, they will be assigned a new sessionid.

So, say a user is on your home page and clicks one of your categories to open in a new window - they will now appear twice in your Users Online. So the more windows they open, the more times they will appear in your Users Online.

Each session remains active for 1 hour by default.

Obviously different people surf in different ways - some people always open up links in new windows - but you will find that most people keep to one session.

In my experience, I have found that if you see many many instances of the same IP appearing multiple times, it's usually a spider (or other automated bot creature) indexing your site - but its badly written - ie. it hasn't been configured to keep the same session.

I usually watch out for these as they can open hundreds of connections in a short amount of time which leads to an unneccesary heavy load on the server.

When I spot these, I run a quick check to see where the ip originates from and then add a 'deny from xxx.xxx.xxx.xxx' in my .htaccess file to stop it in its tracks.

There probably is a way of modifying the code to filter multiple instances of each ip address, but I have found that the original code is just too useful in its present form.

circleofatlantis 06-18-2008 02:59 AM

Re: IP Addresses in Users Online for all users
 
Thanks for that info. Makes things make sense now :)

I've had one persistent robot in, which I traced to a site that says its an experimental robot. I asked for some details and they said it was for a yet to be announced search engine. No follow up details.

I banned it from the site. My stats show its using more bandwidth than Google. And since its been there, my junk mail has gone up about 500%.

Since then, the traffic is actually disapointing, but accurately displayed. :)

But considering that Google hasnt found that part of my site yet, its not surprising.

elmirage001 07-12-2008 10:40 PM

Re: IP Addresses in Users Online for all users
 
This is a great mod! Thanks all of you.

For 4.1.10 - I followed Post #1 with the following:

auth.php
- no changes to Post #1


modules>Users_online>stats.php

Instead of this change
Quote:

$rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"];
$rec['session_ip'] = $data['session_ip'];
$statistics[] = $rec;

I did this
Quote:

$rec['session_create_date'] = $data['session_create_date']+$config["Appearance"]["timezone_offset"];
$rec['session_ip'] = $data['session_ip'];
$statistics[] = $rec;


skin1>modules>Users_online>stats.tpl

Instead of this change
Quote:

<TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.firstname}{if $v.userinfo.status eq 'A'}({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if}
IP: {$v.session_ip}</TD>


I did this
Quote:

<td bgcolor="#FFFFFF" nowrap="nowrap" valign="top">{if $v.userinfo ne ''}<a href="user_modify.php?user={$v.userinfo.login|esca pe:"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}<br />IP: <a href="http://private.dnsstuff.com/tools/whois.ch?ip={$v.session_ip}&cache=on" target="_blank">{$v.session_ip}</a></td>

Thank you Hamid very much!

Paul

hamid 07-13-2008 04:10 PM

Re: IP Addresses in Users Online for all users
 
Hi Paul

Glad you like it - I can't imagine living without it now :)

Hamid

neroag 03-16-2009 09:07 AM

Re: IP Addresses in Users Online for all users
 
For 4.2.0 i use the following ..

In postauth.php find ..
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']:"");
        if (empty($session_create_date))
                $session_create_date = time();

$session_ip = getenv('REMOTE_ADDR');
}


change 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']:"");
        if (empty($session_create_date))
                $session_create_date = time();

        $current_date = time();
$session_ip = getenv('REMOTE_ADDR');
}


in modules/Users_online/stats.php find ...
Code:

        $rec['session_create_date'] = $data['session_create_date']+$config["Appearance"]["timezone_offset"];
        $statistics[] = $rec;


change to ..
Code:

        $rec['session_create_date'] = $data['session_create_date']+$config["Appearance"]["timezone_offset"];
        $rec['session_ip'] = $data['session_ip'];
        $statistics[] = $rec;


in skin1/modules/Users_online/stats.tpl find ..
Code:

<td bgcolor="#FFFFFF" nowrap="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}</td>

change to ..

Code:

<td bgcolor="#FFFFFF" nowrap="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}<br />IP: <a href="http://private.dnsstuff.com/tools/whois.ch?ip={$v.session_ip}&cache=on" target="_blank">{$v.session_ip}</a></td>

Stizerg 05-27-2009 04:55 AM

Re: IP Addresses in Users Online for all users
 
Works without modifications.
Thanks.

hoosierglass 06-10-2009 09:13 AM

Re: IP Addresses in Users Online for all users
 
Is there a way in the stats.tpl to get it to order the list of users online by time of last activity?

gary02140 06-14-2009 06:21 AM

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

Originally Posted by Stizerg
Works without modifications.
Thanks.



Stizerg,

Do you mean the mod works with your v4.1.12?

I am using V4.1.12 crystal blue. Does anyone here have successful experience in integrating this mod into the crystal blue?

In addition, I tried to show users online in admin side only by following a code modification from elsewhere, like

{if $active_modules.Users_online && $usertype ne "C"}
{include file="modules/Users_online/menu_users_online.tpl"}
{/if}

But the above code is the same to the original. And the users online is still shown on the customer side. Very frustrated. Why the v4.1.12 crystal blue is different from other skins?

Can anyone help me out? Many thanks in advance.

Stizerg 06-14-2009 06:13 PM

Re: IP Addresses in Users Online for all users
 
gary02140
Yes. version 4.1.12

If you want to remove users online from customer side you need to edit customer/home.tpl

gary02140 06-14-2009 07:38 PM

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

Originally Posted by Stizerg
gary02140
Yes. version 4.1.12

If you want to remove users online from customer side you need to edit customer/home.tpl


Stizerg,

Thanks! I comment it out and users online is removed from store front. Is this what you did?

Gary

donmck 06-16-2009 09:23 PM

Re: IP Addresses in Users Online for all users
 
I notice dnsstuff just locked out non-members in the last few days.
Anyone come across another dns lookup engine that can be integrated into this mod?

thanks in advance,

Cheers Don...

denlem 06-17-2009 05:59 AM

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

Originally Posted by donmck
I notice dnsstuff just locked out non-members in the last few days.
Anyone come across another dns lookup engine that can be integrated into this mod?

thanks in advance,

Cheers Don...


Find this in your stats.tpl

Code:


http://www.dnsstuff.com/tools/whois.ch?ip=


and change it to:

Code:


http://www.dnsstuff.com/tools/ipall/?tool_id=67&token=&toolhandler_redirect=0&ip=


It's working for me so far and it also gives you a google map with the location!

donmck 06-17-2009 11:47 AM

Re: IP Addresses in Users Online for all users
 
as advertised. very nice.
where do I sent the check :-)

Cheers Don...

gary02140 06-19-2009 04:08 PM

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

Originally Posted by donmck
I notice dnsstuff just locked out non-members in the last few days.
Anyone come across another dns lookup engine that can be integrated into this mod?

thanks in advance,

Cheers Don...


In case that this dnsstuff is not available in the future, http://www.netip.de/ can be a good option. But I just don't know how to code it into the mod. Can someone here figure it out?

denlem 06-19-2009 04:43 PM

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

Originally Posted by gary02140
In case that this dnsstuff is not available in the future, http://www.netip.de/ can be a good option. But I just don't know how to code it into the mod. Can someone here figure it out?


A little different change for this one... Find:

Code:

http://www.dnsstuff.com/tools/whois.ch?ip={$v.session_ip}&cache=off" target="_blank">{$v.session_ip}</a>


And change to:

Code:

http://www.netip.de/search?query={$v.session_ip}" target=_blank">{$v.session_ip}</a>


donmck 06-19-2009 06:33 PM

Re: IP Addresses in Users Online for all users
 
thanks, that link looks a much better proposition.

Cheers Don...

denlem 06-20-2009 06:08 AM

Re: IP Addresses in Users Online for all users
 
I like that one better myself, but don't know how accurate it will be. I just checked one that should be from Florida (USA), but it shows it's location as in the water, on the equator, off the coast of Africa.

gary02140 07-03-2009 12:51 PM

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

Originally Posted by denlem
I like that one better myself, but don't know how accurate it will be. I just checked one that should be from Florida (USA), but it shows it's location as in the water, on the equator, off the coast of Africa.



http://phpweby.com/services/iplocation?ip={$v.session_ip}" target=_blank">{$v.session_ip}</a>

This one is more accurate and free.

toolauthority 07-10-2009 05:23 AM

Re: IP Addresses in Users Online for all users
 
I have run into that problem when I worked with the Google Maps API, that location is 0,0. Basically, it couldn't locate it.

gary02140 07-11-2009 06:24 PM

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

Originally Posted by toolauthority
I have run into that problem when I worked with the Google Maps API, that location is 0,0. Basically, it couldn't locate it.


I haven't got the same problem yet after switch. And the new one works well for me.

William Lam 09-05-2009 01:36 AM

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

I followed your exact steps, all seems ok, but the IP address is not showing up.

Im using 4.2.2

dwpers 02-04-2010 10:28 AM

Re: IP Addresses in Users Online for all users
 
I see some are using this with 4.2, but when I look for auth.php I only see auth.tpl and I don't see the users online code.

This is what I have:

Code:

{*
$Id: auth.tpl,v 1.51 2008/12/08 08:40:11 svowl Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{if $main ne "login_incorrect" and $main ne "antibot_error" and $main ne "disabled" or $config.Security.use_secure_login_page eq "Y"}
{capture name=menu}
{if $config.Security.use_https_login eq "Y"}
{assign var="form_url" value=$https_location}
{else}
{assign var="form_url" value=$current_location}
{/if}
<form action="{$form_url}/include/login.php" method="post" name="authform" onsubmit="javascript: return lockForm(this);">
<input type="hidden" name="{$XCARTSESSNAME}" value="{$XCARTSESSID}" />
<table cellpadding="0" cellspacing="0" class="AuthBox" align="center">
{if $config.Security.use_secure_login_page eq "Y"} {* use_secure_login_page *}
<tr>
<td>
{assign var="slogin_url_add" value=""}
{if $usertype eq "C"}
{assign var="slogin_url" value=$catalogs_secure.customer}
{if $catalogs_secure.customer ne $catalogs.customer}
{assign var="slogin_url_add" value="?`$XCARTSESSNAME`=`$XCARTSESSID`"}
{/if}
{elseif $usertype eq "P" and $active_modules.Simple_Mode eq "Y" or $usertype eq "A"}
{assign var="slogin_url" value=$catalogs_secure.admin}
{elseif $usertype eq "P"}
{assign var="slogin_url" value=$catalogs_secure.provider}
{elseif $usertype eq "B"}
{assign var="slogin_url" value=$catalogs_secure.partner}
{/if}
{include file="buttons/secure_login.tpl"}
</td>
</tr>
{else} {* use_secure_login_page *}
<tr>
<td class="VertMenuItems">
<font class="VertMenuItems">{$lng.lbl_username}</font><br />
<input type="text" name="username" size="17" value="{#default_login#|default:$username}" /><br />
<font class="VertMenuItems">{$lng.lbl_password}</font><br />
<input type="password" name="password" size="17" maxlength="64" value="{#default_password#}" /><br />
<input type="hidden" name="mode" value="login" />
{if $active_modules.Simple_Mode ne "" and $usertype ne "C" and $usertype ne "B"}
<input type="hidden" name="usertype" value="P" />
{else}
<input type="hidden" name="usertype" value="{$usertype|escape}" />
{/if}
<input type="hidden" name="redirect" value="{$redirect|amp}" />
</td></tr>
{if $active_modules.Image_Verification and $show_antibot.on_login eq 'Y' && $login_antibot_on}
<tr>
<td class="VertMenuItems">
{include file="modules/Image_Verification/spambot_arrest.tpl" mode="simple_column" id=$antibot_sections.on_login}
</td>
</tr>
{/if}
{if $usertype ne "C" and ($usertype ne "B" or $config.XAffiliate.partner_register ne "Y")}
<tr>
<td align="center" height="24" class="VertMenuItems"><br />{include file="buttons/login_menu.tpl" style="button" button_style="menu"}</td>
</tr>
{/if}
{/if} {* use_secure_login_page *}
{if $usertype eq "C" or ($usertype eq "B" and $config.XAffiliate.partner_register eq "Y")}
<tr>
<td align="center" height="24" nowrap="nowrap" class="VertMenuItems">
<br />
<table cellpadding="0" cellspacing="0">
<tr>
{if $config.Security.use_secure_login_page ne "Y"}
<td height="24" class="VertMenuItems">{include file="buttons/login_menu.tpl" style="button" button_style="menu"}</td>
<td><img src="{$ImagesDir}/spacer.gif" width="10" height="1" alt="" /></td>
{/if}
<td>{include file="buttons/create_profile_menu.tpl" style="button" button_style="menu"}</td>
</tr>
</table>
</td>
</tr>
{/if}
{if $login eq ""}
<tr>
<td align="center" height="24" nowrap="nowrap" class="VertMenuItems"><a href="help.php?section=Password_Recovery" class="VertMenuItems" style="text-decoration: underline;">{$lng.lbl_recover_password}</a></td>
</tr>
{/if}
{if $is_https_zone && (($usertype eq "P" && $active_modules.Simple_Mode) || $usertype eq "A")}
<!-- insecure login form link -->
<tr>
<td class="VertMenuItems">
<br />
<div align="center"><a href="insecure_login.php" class="SmallNote">{$lng.lbl_insecure_login}</a></div>
</td>
</tr>
<!-- insecure login form link -->
{/if}
</table>
</form>
{/capture}
{ include file="menu.tpl" dingbats="dingbats_authentification.gif" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu }
{/if}


A1Gifts 02-04-2010 01:48 PM

Re: IP Addresses in Users Online for all users
 
I know this is an old thread but I have 4.2.2 and my postauth.php is different than the example given on any page. My postauth.php looks like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?php
/************************************************** ***************************\
#
# $Id: postauth.php,v 1.6.2.2 2009/06/18 07:34:23 aim Exp $
#

if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }
# Prevent double inclusion.
if (defined('INCLUDED_POSTAUTH_PHP')) {
return;
}

define('INCLUDED_POSTAUTH_PHP', 1);
x_session_register("logout_user");
x_session_register("session_failed_transaction");
x_session_register("add_to_cart_time");

x_session_register("always_allow_shop");
x_session_register("search_data");

if (!empty($_GET["shopkey"]))
$always_allow_shop = (!empty($config["General"]["shop_closed_key"]) && $_GET["shopkey"] == $config["General"]["shop_closed_key"]);

if ($config["General"]["shop_closed"] == "Y" && !$always_allow_shop){
#
# Close store front
# Thanks to rubyaryat for the Shop Closed mod
#
if (!func_readfile($xcart_dir.DIRECTORY_SEPARATOR.$sh op_closed_file, true))
echo func_get_langvar_by_name("txt_shop_temporarily_una ccessible",false,false,true);
exit();
}

require $xcart_dir."/include/nocookie_warning.php";
if (!defined('HTTPS_CHECK_SKIP')) {
@include $xcart_dir.DIR_CUSTOMER."/https.php";
}

if (!empty($active_modules['Users_online']) || !empty($active_modules["Greet_Visitor"])) {
x_session_register("session_create_date");
if (empty($session_create_date))
$session_create_date = time();
}

if (!empty($active_modules['Users_online'])) {
x_session_register("current_url_page");
x_session_register("current_date");
$current_url_page = $php_url['url'].($php_url['query_string']?"?".$php_url['query_string']:"");

$current_date = time();
}

#
# Display
#
x_session_register("wlid");
if (isset($_GET["wlid"]) and $_GET["wlid"])
$wlid = $_GET["wlid"];

$smarty->assign("wlid", $wlid);
#
# Browser have disabled/enabled javasript switching
#
x_session_register("js_enabled", "Y");

if (!isset($js_enabled)) $js_enabled="Y";
if (isset($_GET["js"])) {
if ($_GET["js"]=="y") {
$js_enabled = "Y";
$config['Adaptives']['isJS'] = "Y";
$adaptives['isJS'] = "Y";
}
elseif ($_GET["js"]=="n") {
$js_enabled = "";
}
}

$qry_string = func_qs_remove($php_url['query_string'], 'js');
$js_update_link = $php_url['url'].'?'.(!empty($qry_string) ? $qry_string."&" : "");
if ($js_enabled == "Y") {
$js_update_link .= "js=n";
} else {
$js_update_link .= "js=y";
}
unset($qry_string);

$smarty->assign("js_update_link", $js_update_link);
$smarty->assign("js_enabled", $js_enabled);

x_session_register("top_message");
if (!empty($top_message)) {
$top_message['type'] = !empty($top_message['type']) ? $top_message['type'] : "I";
switch ($top_message['type']) {
case "E":
$top_message['title'] = func_get_langvar_by_name("lbl_error", array(), false, true);
break;

case "W":
$top_message['title'] = func_get_langvar_by_name("lbl_warning", array(), false, true);
break;

default:
$top_message['title'] = func_get_langvar_by_name("lbl_information", array(), false, true);
}
$smarty->assign("top_message", $top_message);
if ($config['Adaptives']['is_first_start'] != 'Y')
$top_message = "";

x_session_save("top_message");
}

$cat = intval(@$cat);
$page = intval(@$page);

if (!empty($active_modules['XAffiliate'])) {
include $xcart_dir."/include/partner_info.php";
include $xcart_dir."/include/adv_info.php";
}

include $xcart_dir.DIR_CUSTOMER."/referer.php";
include $xcart_dir."/include/check_useraccount.php";
include $xcart_dir."/include/get_language.php";
$lbl_site_name = strip_tags(func_get_langvar_by_name("lbl_site_titl e", "", false, true));
$location = array();
$location[] = array((!empty($lbl_site_name) ? $lbl_site_name : $config["Company"]["company_name"]), "home.php");

include $xcart_dir.DIR_CUSTOMER."/minicart.php";
if (!empty($active_modules["Interneka"])) {
include $xcart_dir."/modules/Interneka/interneka.php";
}

if (!empty($active_modules["Subscriptions"])) {
if ($login) {
include $xcart_dir."/modules/Subscriptions/get_subscription_info.php";
$smarty->assign("user_subscription", is_user_subscribed($login));
}
}

$pages_menu = func_query("SELECT * FROM $sql_tbl[pages] WHERE language='$store_language' AND active='Y' AND level='E' AND show_in_menu='Y' ORDER BY orderby, title");
$smarty->assign("pages_menu", $pages_menu);

$speed_bar = unserialize($config["speed_bar"]);
if (!empty($speed_bar)) {
$tmp_labels = array();

foreach ($speed_bar as $k => $v) {
if ($v["active"] != "Y") {
unset($speed_bar[$k]);
continue;
}

$speed_bar[$k] = func_array_map("stripslashes", $v);
$tmp_labels[] = "speed_bar_".$v['id'];
}

if (!empty($speed_bar)) {
$tmp = func_get_languages_alt($tmp_labels);
foreach ($speed_bar as $k => $v) {
if (isset($tmp['speed_bar_'.$v['id']]))
$speed_bar[$k]['title'] = $tmp['speed_bar_'.$v['id']];
}

$smarty->assign("speed_bar", array_reverse($speed_bar));
}
}

unset($speed_bar);
$smarty->assign("redirect", "customer");
if (!empty($active_modules["News_Management"]))
include $xcart_dir."/modules/News_Management/news_last.php";

if (!empty($active_modules["Feature_Comparison"])) {
include $xcart_dir."/modules/Feature_Comparison/comparison_products.php";

if ($config['Feature_Comparison']['fcomparison_show_product_list'] == 'Y') {
$comparison_list = func_get_comparison_list();
$smarty->assign("comparison_list",$comparison_list);
}
}

if (!empty($active_modules["Survey"])) {
include_once $xcart_dir."/modules/Survey/surveys_list.php";
}

if (!empty($active_modules['Special_Offers'])) {
include_once $xcart_dir."/modules/Special_Offers/check_new_offers.php";
}

if (isset($printable))
$smarty->assign("printable", $printable);
$smarty->assign("logout_user", $logout_user);

?>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I hate to just assume I can change anything even if it doesn't like the examples given.

Anyone able to help??

Thank you!

A1Gifts
www.A1DiscountGifts.com

Dan.roh 02-12-2010 03:12 PM

Re: IP Addresses in Users Online for all users
 
Works perfect for me in 4.1! I just added a <br/> before the "IP:" as I prefer the IP to display underneath customer in admin. Thanks for sharing!

Not sure if this already shows up in your admin area but it does not in mine and it was a bit frustrating for me as I also wanted to be able to see from my admin "users online" the actual amount of users on my site as well as the amount of adminastrators that is logged into admin so this is what I did

In xcart>skin1>modules>Users_online>stats.tpl

at the top line 2 right underneath {* $Id: stats.tpl............ I placed the following code

{if $users_online}
<div class="BottomDialogBox">
{$lng.lbl_users_online}:
{foreach from=$users_online item=v name="_users"}
<font class="VertMenuItems" style="WHITE-SPACE: nowrap;">{$v.count}
{strip}
{if $v.usertype eq 'A' || ($v.usertype eq 'P' && $active_modules.Simple_Mode)}
{$lng.lbl_admin_s}
{elseif $v.usertype eq 'P'}
{$lng.lbl_provider_s}
{elseif $v.usertype eq 'B'}
{$lng.lbl_partner_s}
{elseif $v.usertype eq 'C' && $v.is_registered eq 'Y'}
{$lng.lbl_registered_customer_s}
{elseif $v.usertype eq 'C' && $v.is_registered eq 'A'}
{$lng.lbl_anonymous_customer_s}
{elseif $v.usertype eq 'C' && $v.is_registered eq ''}
{$lng.lbl_unregistered_customer_s}
{/if}
{if not $smarty.foreach._users.last} {/if}
{/strip}
</font>
{/foreach}
</div>
{/if}


I also placed the same code right at the bottom of stats.tpl underneath all code as it makes that bit of a difference to me


Quote:

Originally Posted by hamid
With this mod you can see the IP Address of all users (including "Unregistered User") in the Users Online page.

I've only tested this mod with v4.0.14, but it should work just as well in 4.0.x.

It's really easy to implement this modification, but remember to backup your files before you make any changes.

What the following changes do is:

1. Creates a new entry in session data called session_ip
2. Saves users IP address in session_ip
3. Calls session_ip data in the .tpl file

You have to change 3 files:

1. auth.php
2. xcart>modules>Users_online>stats.php
3. xcart>skin1>modules>Users_online>stats.tpl

On (or around) line 64 in auth.php look for:


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']:"");
    if(empty($session_create_date))
        $session_create_date = time();
    $current_date = time();
}

***********************************************

And change it to:

***********************************************

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']:"");
    if(empty($session_create_date))
        $session_create_date = time();
    $current_date = time();
    $session_ip = getenv('REMOTE_ADDR');
}

***********************************************


Then on line 50 in xcart>modules>Users_online>stats.php look for:

Code:

***********************************************

$vars = array("login", "login_type", "cart", "current_date", "current_url_page", "session_create_date");

***********************************************

And change it to:

***********************************************

$vars = array("login", "login_type", "cart", "current_date", "current_url_page", "session_create_date", "session_ip");

***********************************************


In the same file (stats.php), look for the following on line 94:

Code:

***********************************************

$rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"];
$statistics[] = $rec;

***********************************************

And change it to:

***********************************************

$rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"];
$rec['session_ip'] = $data['session_ip'];
$statistics[] = $rec;

***********************************************


And finally you have to put "IP: {$v.session_ip}" into xcart>skin1>modules>Users_online>stats.tpl

On line 20 look for:

Code:

***********************************************

<TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.firstname}{if $v.userinfo.status eq 'A'}
({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if}</TD>

***********************************************

And change it to:

***********************************************

<TD bgcolor="#FFFFFF" nowrap valign="top">{if $v.userinfo ne ''}{$v.userinfo.firstname} {$v.userinfo.firstname}{if $v.userinfo.status eq 'A'}({$lng.lbl_anonymous_customer}){/if}{else}{$lng.lbl_unregistered_customer}{/if}
IP: {$v.session_ip}</TD>

***********************************************


That's all the changes done, now go to the Users Online section [in Admin>Statistics>Users Online] and the IP Address of customers currently on your site should appear underneath their names.

If you reload your Users Online page at regular intervals you can watch how your customers navigate your site.



All times are GMT -8. The time now is 04:52 AM.

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