Hello,

please is there any Javascript or the PHP code which print the Advertisement only if page do not contains bad keywords?

Example Adsense do not allow Publishers to add Ads on pages with smoking content and adult content.

So i would like to add Adsense or other Ad code into website, but let it be shown only if like sex*, cigar* keywords are missing.

Thank you


Solutions found so far:

This is Smarty code which can be used in Smarty websites:
Code:
{if $DESCRIPTION|stristr:"porn" || $DESCRIPTION|stristr:"erot" || $DESCRIPTION|stristr:"sex" || $DESCRIPTION|stristr:"cigar" || $DESCRIPTION|stristr:"warez" || $DESCRIPTION|stristr:"casin" || $DESCRIPTION|stristr:"kasín" || $DESCRIPTION|stristr:"kasin" || $DESCRIPTION|stristr:"rulet" || $DESCRIPTION|stristr:"poker"}
<!--bad phrasse was found-->
{else}
{literal}
advertisement code here, no bad phrasse was found
{/literal}
{/if}
PHP code (but this code is probably very ineffective regarding server CPU):
Code:
<?php
if (stristr($DESCRIPTION,"porn") || stristr($DESCRIPTION,"erot") || stristr($DESCRIPTION,"sex") || stristr ($DESCRIPTION,"cigar")){
// || $DESCRIPTION|stristr:"warez" || $DESCRIPTION|stristr:"casin" || $DESCRIPTION|stristr:"kasín" || $DESCRIPTION|stristr:"kasin" || $DESCC
RIPTION|stristr:"rulet" || $DESCRIPTION|stristr:"poker"){
// bad phrasse was found, lets show no ads
}
else
{
// advertisement code here, no bad phrasse was found
}
?>
it works in this case with variable $DESCRIPTION which contains text of the article. If that variable do not contains bad phrasses (even partial phrasses, case in-sensitive), advertisement code is shown