Regular expression can also be another way out of this. I did something to detect sites with inappropriate urls not long ago, like this:
#blacklist.php
return array(
'(.*)\.(xxx)',
'4tube\.com',
'clickme\.net',
'cnnamador\.com',
'extremefuse\.com',
'fakku\.net',
'fux\.com(?!\.br)', //Com .br é de advogados
'heavy-r\.com',
'kaotic\.com',
'xhamster\.com',
'porndoe\.com',
'pornocarioca\.com',
'rapebait\.net',
'redtube\.com',
'sex\.com',
'vidmax\.com',
'wipfilms\.net',
'xvideos\.(com|net)',
'porntube\.com',
);
This is how I use a function:
public static function isBlockedHost($url)
{
$keywords = (array) include 'blacklist.php';
foreach ($keywords as $regex) {
if (preg_match("/{$regex}/i", $url) > 0) return true;
}
return false;
}
Think that if I could do this with hosts, you can also do this with words that you want to block. As they pop up, you can add them to an array.