PDA

View Full Version : adult content filter



sunnyverma1984
December 1st, 2007, 07:58
hello friends my site thepagerank.net in now making about $6500 per month
but i have some problem becouse today i recievd a mail from google

While reviewing your account, we noticed that you are currently displaying Google ads in a manner that is not compliant with our policies. For instance, we found violations of AdSense policies on pages such as www.thepagerank.net/website/gapingpussy.com.

As stated in our program policies, AdSense publishers are not permitted to place Google ads on pages with adult or mature content.

Please make any necessary changes to your web pages in the next 3 business days. We also suggest that you take the time to review our program policies (https://www.google.com/adsense/policies) to ensure that all of your other pages are in compliance.

Once you update your site, we will automatically detect the changes and ad serving will not be affected. If you choose not to make the changes to your account within the next three days, your account will remain active but you will no longer be able to display ads on the site. Please note, however, that we may disable your account if further violations are found in the future.

Now i need adult content filter in php EX:
Lets i have list of adult keywords in a array $adult and content in $content.
then how to match each on them with site content and if found then dont display adsense code

please help me

thank you in advance

themoose
December 1st, 2007, 09:52
$content = str_ireplace($adult, "-----", $content);

Should do the job.

I used str_ireplace so that it's case-insensitive.

If you're not using php5 you'll need to put this in too, just before.

if (!function_exists('str_ireplace') {
function str_ireplace($search,$replace,$subject) {
$token = '^[[term^]';
$haystack = strtolower($subject);
$needle = strtolower($search);
while (($pos=strpos($haystack,$needle))!==FALSE) {
$c++;
$subject = substr_replace($subject,$token,$pos,strlen($search));
$haystack = substr_replace($haystack,$token,$pos,strlen($search));
}
while (($pos=strpos($subject,$token))!==FALSE) {
$subject = substr_replace($subject,$replace,$pos,strlen($token));
}
return $subject;
}
}

krakjoe
December 1st, 2007, 16:33
if (!function_exists('str_ireplace') {
function str_ireplace($search,$replace,$subject) {
$token = '^[[term^]';
$haystack = strtolower($subject);
$needle = strtolower($search);
while (($pos=strpos($haystack,$needle))!==FALSE) {
$c++;
$subject = substr_replace($subject,$token,$pos,strlen($search));
$haystack = substr_replace($haystack,$token,$pos,strlen($search));
}
while (($pos=strpos($subject,$token))!==FALSE) {
$subject = substr_replace($subject,$replace,$pos,strlen($token));
}
return $subject;
}
}

never copy code from php.net and assume it will work for you ...



if( !function_exists( 'str_ireplace' ) )
{
function str_ireplace( $search, $replace, $subject )
{
if( is_array( $search ) )
{
foreach( $search as $id => $find )
{
$search[$id] = sprintf( "~%s~i", preg_quote( $find, '~' ) );
}
}
else
{
$search = sprintf( "~%s~i", preg_quote( $search, '~' ) );
}

return preg_replace( $search, $replace, $subject );
}
}

themoose
December 1st, 2007, 17:48
Actually you can probably just use preg_replace on it's own.. I think that's case-insensitive.

krakjoe
December 1st, 2007, 17:52
preg_replace takes full delimited regex expressions, so you'd need to specify i as a modifier, and also, the strings you want to search for wouldn't be a regex expressions and may contain characters that are special characters for regex patterns hence the use of preg_quote ...

sunnyverma1984
December 2nd, 2007, 02:42
thank you everyone for helping me now i have made a funcion which can detect the adult content

function isadult($content)
{
$keywords="sex,----,gay,lesbian,xxx,porn,rape,blowjob,explicit,adult,penis,hard core,----,amateur,nude,voyeur,tits,---,seins,poitrine,upskirt,preteen,horny,femme,pussy,gangbang,a nal,panty,nymphets";
$keywords=explode(",",$keywords);
foreach($keywords as $key)
{
if(eregi($key,$content))
{
return true;
}
}
return false;
}
I dont want to replace it i only want to detect it if found then i will not display google ads on that page.

JohnN
December 3rd, 2007, 18:28
you could filter content depending on the user agent, this can be accessed from $_SERVER i believe, google has a unique one and therefore modifying files so that the robot doesn't see it shouldn't be an issue.

prudes:p

themoose
December 3rd, 2007, 18:40
you could filter content depending on the user agent, this can be accessed from $_SERVER i believe, google has a unique one and therefore modifying files so that the robot doesn't see it shouldn't be an issue.

prudes:p

Yeah, that'd be against Adsense's TOS.

JohnN
December 3rd, 2007, 18:57
That i never knew.

I'm banned anyway, something tells me its just as well:p

themoose
December 4th, 2007, 19:24
Well it's pretty obvious if you ask me.