nelle espressioni regolari devi mascherare gli slash e togliere quei segni non validi tipo il "+".
per automatizzare un attimo ti conviene sostituire il tuo "3" statico con "count($spider_user_agent)".

prova cosi:

Codice PHP:
<?php
$ctr
=0;
$spider_search_engine_ctr=0;
$sys $_SERVER["HTTP_USER_AGENT"];

$spider_search_engine_n=count($spider_user_agent);

$spider_user_agent[1] = "Mozilla\/5.0 (compatible; Yahoo! Slurp; http:\/\/help.yahoo.com\/help\/us\/ysearch\/slurp)";
$spider_user_agent[2] = "Mozilla\/5.0 (compatible; Googlebot\/2.1; +http:\/\/www.google.com\/bot.html)";
$spider_user_agent[3] = "msnbot\/1.0 (http:\/\/search.msn.com\/msnbot.htm)";

for (
$i 1$i <= $spider_search_engine_n$i++) 

    if (
preg_match("/".$spider_user_agent[$i]."/i"$sys)) 
    {
        
$spider_search_engine_ctr=1;
    }
}

if (
$spider_search_engine_ctr!=1)
{
    echo 
"non è un bot";
}
else
{
    echo 
"bot";
}
?>
purtroppo il forum mi rimaschera gli slash cmq intendevo così:

$spider_user_agent[1] = "Mozilla\/5.0 (compatible; Yahoo! Slurp; http:\/\/help.yahoo.com\/help\/us\/ysearch\/slurp)";
$spider_user_agent[2] = "Mozilla\/5.0 (compatible; Googlebot\/2.1; +http:\/\/www.google.com\/bot.html)";
$spider_user_agent[3] = "msnbot\/1.0 (http:\/\/search.msn.com\/msnbot.htm)";