On one of my blog i am forcing people to view 1 ad per ip in a day when they open it.
main problem was to stop bots to redirect to ad so they can crawl the blog to search engine.

This is what i created, i am not sure if it will work fine.
PHP Code:
$bots="Bingbot
Googlebot
Googlebot-Image
Yahoo! Slurp
Yahoo! Slurp China
YahooSeeker
YandexBot
YodaoBot"
;
$bots=explode("\n"$bots);
if (!
in_array("$_SERVER[HTTP_USER_AGENT]"$bots)) {
// ad redirect codes here

Please let me know if i am doing it right or wrong.