Reply to Re: Can you avoid that googlebot indexes PHPSESSID pages?

Your name:

Reply:


Posted by Juan Jos Gutirrez de Quevedo Prez on 04/12/06 13:30

El 12 Apr 2006 03:13:01 -0700
fletch escribió:

[..]
> foreach($aSpiderUAs as $iPos=>$sSpiderUA) {
> if (strpos($sHTTPUserAgent,$sSpiderUA)!==false)
> {
> $iSpiderID = $iPos;
> $sSID = $iSpiderID.'00000000';
> $bCaughtASpider = true;
> }
> }
> }

just an off-topic note:

you really want to break from the foreach loop once you have found a
spider so that you don't have to loop through the whole array once you
have found a spider(that array may become really big with time).

also, you are keeping $iSpiderID, so for example if altavista user
agent is "altavista spider", you'll get the $iSpiderID of spider, NOT
of altavista.

it should be like this:

foreach($aSpiderUAs as $iPos=>$sSpiderUA)
if(strpos($sHTTPUserAgent,$sSpiderUA)!==false)
{
$iSpiderID=$iPos;
$sSID=$iSpiderID.'00000000';
$bCaughtASpider=true;
break;
}

you should also initialize $bCaughtASpider as false(you may already be
doing it, but you haven't pasted it in this bit) as it's always good to
initialize variables.


--
Juan José Gutiérrez de Quevedo
Director Técnico (juanjo@iteisa.com)
ITEISA (http://www.iteisa.com)
942544036 - 637447953

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация