php check if any of many characters are in one long string?

Joined
12 Feb 2006
Posts
17,680
Location
Surrey
i've got a tracking script which is working well enough to show visitors, however the bots are messing up the results.

at the moment i've got a list of what i don't want from the user agent and do a strpos for each one such as

$findme1 = 'bot';
$findme2 = 'spider';
$pos1 = strpos($mystring, $findme1);
$pos2 = strpos($mystring, $findme2);
if ($pos1 === false && $pos2 === false) {
update tracking
}

however this i know this is no good for doing many times. it's now at 10 checks so i would like a quicker way but unsure how.

thanks
 
Back
Top Bottom