<?php
if (!function_exists('array_shuffle')) {
function array_shuffle(&$array) {
for ($i=0; $i<count($array); $i++) {
$j = mt_rand(0,count($array)-1);
$tmp = $array[$j];
$array[$j]=$array[$i];
$array[$i]=$tmp;
}
}
}
if (!function_exists('onAdBlock')) {
function onAdBlock($jsfn='window.AdBlock=true;') {
$false_positives = Array(
'_ad.aspx','?adtype=','_adbrite','_ads.php?',
'_banner_ad','_adspace',
'google.com/promo_','interclick.',
'js.worthathousandwords','hera.hardocp',
'pro-market.','richmedia.yimg','.adbureau.',
'.adbrite.com/ab','.atdmt.com/',
'.projectwonderful.','http://ad.localhost',
'http://ads.localhost','/ads/','/ajs.php?',
'.doubleclick.'
);
array_shuffle($false_positives);
$false_positive = $false_positives[0];
$vars = Array();
for ($i=0; $i<10; $i++)
$vars[$i]=
substr(str_shuffle(
'abcdefghijklmnopqrstuvwxyz'.
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
'$_'
),0,mt_rand(5,15));
$atts = Array(
'visibility: \'hidden\'',
'width: \'1px\'',
'height: \'1px\'',
'border: \'none\'',
'position: \'absolute\'',
);
array_shuffle($atts);
$atts = 'var '.$vars[4].'= { '.join(', ',$atts).' }; ';
$cmds = Array(
$vars[3].'('.$vars[1].' .style,'.$vars[4].');',
$vars[1].' .setAttribute (\'src\', \''.$false_positive.'\'); ',
'document .body .appendChild ('.$vars[1].'); ',
'function '.$vars[3].'('.$vars[4].', '.$vars[5].') { '.
'for ( var '.$vars[6].' in '.$vars[5].' ) '.
$vars[4].'['.$vars[6].']='.$vars[5].'['.$vars[6].'];'.
'return '.$vars[4].'; '.
'}; '
);
$pcmds = Array (
$vars[1].' = document .createElement (\''.(mt_rand(0,1)==0?'img':'iframe').'\');',
$atts
);
$calls = array (
$vars[1].'.parentNode .removeChild('.$vars[1].');',
'if ( '.$vars[1].'.style .display==\'none\' ) '.$vars[2].' (); '
);
array_shuffle($cmds);
array_shuffle($calls);
$out =
'<script type="text/javascript"> '.
'function '.$vars[0].' ('.$vars[2].') {'.
join(' ',$pcmds).
join(' ',$cmds).
'setTimeout ( '.
'function() { '.join('',$calls).' }, '.
mt_rand(250,750).' ); '.
'}'.
'window .onload = function () {'.
$vars[0].'( function () { '.
'%%JSFN%% '.
'} ); '.
'};'.
'</script>';
$out = split(' ',$out);
$ret = '';
foreach ($out as $bit)
$ret .= $bit.substr(str_shuffle("\r\n\t\r\n \t "),0,mt_rand(1,8));
echo trim(str_replace('%%JSFN%%',$jsfn,$ret);
}
}
?>