Zen Cart Logo
Forums / General Questions / Spiders - Filtering from Who's Online?

Spiders - Filtering from Who's Online?

Locked

Views: 2,326

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
21 Feb 2007, 4:41 PM
#1
wmarcy avatar

wmarcy

Zen Follower

Join Date:
Dec 2005
Posts:
113
Plugin Contributions:
0

Spiders - Filtering from Who's Online?

Is there any way to filter out or not show spider sin the Who's Online display? I always have 15 or 20 spiders online at any one time and it makes getting to the customers less easy.

21 Feb 2007, 9:37 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Spiders - Filtering from Who's Online?

In your admin > Configuration > Sessions > Prevent spider sessions & set to true.

21 Feb 2007, 9:39 PM
#3
wmarcy avatar

wmarcy

Zen Follower

Join Date:
Dec 2005
Posts:
113
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

Hmmm, just checked And it is set to true.

22 Feb 2007, 5:13 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Spiders - Filtering from Who's Online?

Why don't you use the sort options ...

Click on Asc or Desc and it sorts spiders, guests and members for you ...

There are a bazillion other ways to sort as well ...

22 Feb 2007, 12:19 PM
#5
wmarcy avatar

wmarcy

Zen Follower

Join Date:
Dec 2005
Posts:
113
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

The sort optiosn are ok for a temporary fix and I have been using them, but I would prefer some sort of code option, preferably an admin switch to just not show them at all on the whos online display.

Would it be a smple matter of a chunk of code If User=spider then ignore kind thing?

22 Feb 2007, 1:28 PM
#6
wmarcy avatar

wmarcy

Zen Follower

Join Date:
Dec 2005
Posts:
113
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

Ok, looking at the code, the first thing we do code wise when whos online is called is check for bots:

// highlight bots
function zen_check_bot($checking) {
// googlebot.com and google.com
if (empty($checking)) {
return true;
} else {
return false;
}
}

Since we know at the outset who a bot is, wouldn't it be doable to filter out those bots, to not show at all in the list?

Or in my n00bieness, I can't see why it would be undesirable or untenable to code?

22 Feb 2007, 2:00 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Spiders - Filtering from Who's Online?

It can be done ... by adding an exclusion to the select table first ...

Bots do not have session_id so if you don't pull the blanks you don't see them ...

I have not looked to see what this would do beyond change the display ...

If I were coding for this I would set an option for bots or no bots that can be switched on/off ...

NOTE: there are no overrides for the admin files so backup your files before making changes ...

22 Feb 2007, 2:10 PM
#8
wmarcy avatar

wmarcy

Zen Follower

Join Date:
Dec 2005
Posts:
113
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

What do you think about adding another line to this code:

// remove entries that have expired
$db->Execute("delete from " . TABLE_WHOS_ONLINE . "
where time_last_click < '" . $xx_mins_ago . "'
or (time_entry=time_last_click
and time_last_click < '" . $xx_mins_ago_dead . "')");

That stripped spiders out Linda?

22 Feb 2007, 2:17 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Spiders - Filtering from Who's Online?

It would be easier to just add an exclusion to the select statement for what is going to be listed I think ...

Why mess up the logic of the tables?

22 Feb 2007, 6:00 PM
#10
wmarcy avatar

wmarcy

Zen Follower

Join Date:
Dec 2005
Posts:
113
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

I agree Linda, I will look into getting someone to make the tweak for me, as I am dangerously close to be over my head as it is.

15 Jun 2010, 1:42 PM
#11
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

Here is what I changed in who's online to accomplish filtering out the spiders around line 197 zen 1.3.8:

changed this:

$whos_online = $db->Execute("select customer_id, full_name, ip_address, time_entry, time_last_click,
                                      last_page_url, session_id, host_address, user_agent
                               from " . TABLE_WHOS_ONLINE . "
                               order by $order");

to this:

$whos_online = $db->Execute("select customer_id, full_name, ip_address, time_entry, time_last_click,
                                      last_page_url, session_id, host_address, user_agent
                               from " . TABLE_WHOS_ONLINE . "
                               where full_name <> '¥Spider'
                               order by $order");

~DD

15 Jun 2010, 4:18 PM
#12
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

I also added this around line 334 to show what product they were looking at :

I changed this:

} else {
                      echo "<a href='" . $whos_online->fields['last_page_url'] . "' target=new>" . '<u>' . $whos_online->fields['last_page_url'] . '</u>' . "</a>";
 }

to this :

 } else {
										
						$result = preg_match("/products_id=([0-9999]*)/", $whos_online->fields['last_page_url'], $matches);
						
						if ($result) {
						
						$model_var = $matches[1];
						
						$model_qry = $db->Execute("select products_id, products_name
                               from " . TABLE_PRODUCTS_DESCRIPTION . "
							   where " . $model_var . "= products_id
                               ");
						
						$model_num =  $model_qry->fields['products_name'];
						
						
						} else {
						
						$model_num = $whos_online->fields['last_page_url'];
						
						}
							
                      echo "<a href='" . $whos_online->fields['last_page_url'] . "' target=new>" . '<u>' . $model_num  . '</u>' . "</a>";
 }

Thought I would share this too.

~DD

1 Feb 2011, 3:42 PM
#13
orchidlake avatar

orchidlake

New Zenner

Join Date:
Dec 2008
Location:
Florida
Posts:
50
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

love it! thanks so much for the code - especially the product text code.

2 Feb 2011, 3:14 PM
#14
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

Thanks, I'm glad this helps. I have since updated the products code...

                    } else {
									
						if (preg_match("/products_id=([0-9999]*)/", $whos_online->fields['last_page_url'], $matches)) {
						
						$model_var = $matches[1];
						
						$model_qry = $db->Execute("select products_id, products_name
                               from " . TABLE_PRODUCTS_DESCRIPTION . "
							   where " . $model_var . "= products_id
                               ");
						
						$model_num =  $model_qry->fields['products_name'];
						
						
						} else {
						
						if (preg_match("/cPath=([0-9999_]*)/", $whos_online->fields['last_page_url'], $matches)) {
						
						if (strrchr($matches[1],'_') == true) { 
						
						$model_var = substr(strrchr($matches[1],'_'),+1) ;
						
						} else { 
						
						$model_var = $matches[1];
						
						}
						
															
						$model_qry = $db->Execute("select categories_id, categories_name
                               from " . TABLE_CATEGORIES_DESCRIPTION . "
 							   where " . $model_var . "= categories_id
                               ");
						
						$model_num =  'CAT - ' . $model_qry->fields['categories_name'];
						
						
						} else {
						
						if (preg_match("/main_page=([A-Za-z0-9999_]*)/", $whos_online->fields['last_page_url'], $matches)) {
						
						$model_num = strtoupper ($matches[1]);
						
						} else {
						
						
						if (preg_match("$/$", $whos_online->fields['last_page_url'])){
						
									
						$model_num = 'HOME'; 
						
						} else {
						
						$model_num = $whos_online->fields['last_page_url'];
						
						}
						
						}
						
						} 
						
						}
							
                      echo "<a href='" . $whos_online->fields['last_page_url'] . "' target=new>" . '<u>' . $model_num  . '</u>' . "</a>";
                    }
7 Mar 2011, 4:23 PM
#15
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: Spiders - Filtering from Who's Online?

FANTASTIC ADDITION!

this combined with the enhanced whos online makes life so much sweeter, i think you should certainly add this as to the zen addon directory!

thanks!!