Hello, I am wanted to start ads on a website. But website contain adult nude text. Is there any way to block ads to specific words. Like if the page contain word 'porn' do not show ads. Looking for reply. Thank You.
Definitely possibly as mentioned above but would need a bit more information about how the site is setup as to the best way of searching the content. If the site is database driven or dynamically created will have a different solution to static content.
Example <?php $text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."; if (stripos($text, "dolor") !== false) { echo "Something what you want to show instead of ads"; } else{ echo "ADS"; } ?>
Something like this should work, I haven't tested it. <?php $flag = '/porn/i'; $content = '<h1>Page Title</h1> <p>This is a paragraph with the word porn inside.</p>'; if(!preg_match($flag, $content)) { // not found show content echo $content; } else{ // don't show } ?> PHP:
I have 3 vars to scan the page but i am unable to find how to do this? Is there any one that can help in this matter. $title $description $tags Is there any way to scan the words like aaa, bbb with in $title, $description, and $tags. Looking for help.
I think everyone already gave you an idea of how to find a specific word to ban so, you need to check three vars... ok! Let's take HuggyStudio's one and let's add just few hacks: $flag = '/porn/i'; $title = "This is the Title"; $description = "Description"; $tags = "Here goes a tag"; $content = "Here the content"; if(!preg_match($flag, strip_tags($content." ".$title." ".$description." ".$tags))) { echo $ads } else{ // don't show } PHP: Like this it will check content, title, description and tags.