PDA

View Full Version : Hide something to spiders


Scanu
06-26-2013, 11:15 AM
Hi everyone, vbulletin has a built-in feature that separate guests from spiders (correct me if 'm wrong). what i need is a condition to show something just to guests and not spiders, is this possible with an exsisting vb function? I know i can do this checking $_SERVER['HTTP_USER_AGENT'] but would be easier if there is something already integrated on vbulletin. Does anyone know something about this?

nhawk
06-26-2013, 01:05 PM
Have a look at class_core.php. Search for 'enablespiders'. Spiders are decoded in there.

But any use of the built in vB spider system is only going to be as good as your spiders_vbulletin.xml file.

And there are so many spiders out there you'll never get them all. You're better off completely hiding things from unregistered users. Otherwise one spider will feed off of another spiders scan and the content will be picked up anyway.

Scanu
06-26-2013, 01:19 PM
Thank you i'll look into it btw i know that there isn't a 100% working way but that's enough for me :)

--------------- Added 1372261362 at 1372261362 ---------------

I've done this simple code in parse_templates hook (this is where i need the condition)

require_once(DIR . '/includes/class_xml.php');
$xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/spiders_vbulletin.xml');
$spiderdata = $xmlobj->parse();
$spiders = "";
if (is_array($spiderdata['spider'])) {
foreach ($spiderdata['spider'] AS $spiderling) {
$spiders .= ($spiders ? '|' : '') . preg_quote($spiderling['ident'], '#');
}
}
unset($spiderdata, $xmlobj);
if (preg_match('#(' . $spiders . ')#si', $cleaned['useragent'])) {
$cleaned['isbot'] = true;
}
if ($cleaned['isbot'])
echo 'spider!';
else
echo 'human :)';

But to be honest i'm not sure if it works.. How can i test it? :o I tried with some of web spiders simulator but i still see human..

Simon Lloyd
06-27-2013, 02:51 PM
vBulletin already uses a condition <vb:if condition="!$show['search_engine']"> so anything that shows up in the spiders list gets covered by it :)

Scanu
06-28-2013, 09:16 AM
Thank you very much this will be a lot easier :) i'll try it

Simon Lloyd
06-28-2013, 12:14 PM
Naturally you know to remove or leave the ! depending on whether you want the condition to apply to them or not :)