PDA

View Full Version : Little fix: Message on unathorized spider attempt


shockfreezer
05-14-2006, 11:06 PM
Hi there,

in the last days I was a little fighting with phpDig 1.8.9 RC1 :P
I've found out that no message is displayed if phpDig is unauthorized to spider a site.
Because of this behavior I lost some time, ok also because of my bad capacity for remembering ;) I really had forgotten that we had secured our server with .htaccess.
And I was wondering why phpDig can't spider our site....
So now i had written a little fix that helps prevent things like that. It displays a message if phpDig is unauthorized to spider a site. You have just to replace some code in the file admin/spider.php.
Go to line 511 in the file admin/spider.php.
Replace following code:

else {
$ok_for_index = 1;
if ($content_type == 'HTML') {
$ok_for_spider = 1;
}
}


with this code:


else {
$ok_for_index = 1;
if($content_type == "UNAUTH"){
//print phpdigMsg('not_authorized_toindex').$br;
print "<strong>You're unauthorized to spider this site:</strong>".$br;
}
if ($content_type == 'HTML') {
$ok_for_spider = 1;
}
}


Sure it's quick and dirty, especially the part without localisation, but it's a workaround for the moment. An implementation in RC2, including the localisation wouldn't be to hard ;)

That's it, I hope I can someone save some time with this code :yes:

Greez
shockfreezer