I don't think it's the best practise what you're doing but still:
<?php if (function_exists(‘from_searchengine’)) {
if (from_searchengine()) { ?>
INSERT YOUR ADSENSE/BANNER CODE HERE
<?php } else { ?>
INSERT ANOTHER AD CODE HERE
<?php } } ?>
but it looks better when you do that:
<?php
$ad_code = "INSERT YOUR ADSENSE/BANNER CODE HERE";
$another_ad_code = "INSERT ANOTHER AD CODE HERE";
if (function_exists(‘from_searchengine’)) {
if (from_searchengine()) {
echo $ad_code;
}else{
// if not from search engine
echo $another_ad_code;
}
} else{
// if function doesn't exist
echo $another_ad_code;
}
?>