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)

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


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

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