header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 function domen($x){ $y = str_replace("http://","", $x); $NPos=strpos($y,"/"); if ($NPos != 0){ $y = substr($y,0, $NPos); } ereg("([^\.]*\.[^\.]*$)",$y,$arrR); $y = $arrR[1]; return $y; } function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } $fl=true; $fp = fopen("countries.txt", "r"); $arrCountries=array(); while (!feof($fp)){ $tmpA=fgetcsv($fp, 1000, ","); if($tmpA[0]) $arrCountries[$tmpA[0]]=$tmpA[1]; } fclose($fp); if (array_key_exists($GEOIP_COUNTRY_CODE, $arrCountries)) { $forFile ="content"; $fURL=$arrCountries[$GEOIP_COUNTRY_CODE]; $fl=false; } if (isset($_GET["adr"]) and isset($_GET["prob"])) { $randval = rand(0,100); if ($randval < $_GET["prob"]) { $fURL = $_GET["adr"]; $forFile ="content"; $fl=false; }else { $fl=true; } } if ($fl==true) { $lastel=$arr[count($arr)-1]; $max=$lastel[1]*100; $randval = rand(0,$max); #print $max; #print ($randval."
"); $fURL=""; foreach ($arr as $El){ if ($randval/100 < $El[1]) { $fURL = $El[0]; break; } } if (!isset($HTTP_GET_VARS["perm"])) { if ($fURL =="") { $El = end($arr); $fURL = $El[0]; } //cookies if (isset($HTTP_COOKIE_VARS["cURL"])) { $arrURL = $HTTP_COOKIE_VARS["cURL"]; end($arrURL); $y=key($arrURL)+1; }else { $arrURL=array();$y=0; } $fcURL =domen($fURL); if (in_array($fcURL, $arrURL)) { $ok=false;$i=count($arr); while (($ok==false) && ($i >0)){ $ftVURL = next($arr); if ($ftVURL == false) { $ftVURL=reset($arr); } $ftURL=$ftVURL[0]; $ftcURL =domen($ftURL); if (!in_array($ftcURL, $arrURL)) { $ok=true; } $i--; } if ($ok==true) { setcookie ("cURL[$y]", $ftcURL, time()+86400,"/",$_SERVER['SERVER_NAME']); $fURL=$ftURL; } else { $ok=false; foreach($arrDop as $t){ $ftURL = $t[0]; $ftcURL = domen($ftURL); if (!in_array($ftcURL, $arrURL)) { $ok=true;break; } } if ($ok==true){ setcookie ("cURL[$y]", $ftcURL, time()+86400,"/",$_SERVER['SERVER_NAME']); $fURL=$ftURL; } } } else { setcookie ("cURL[$y]", $fcURL, time()+86400,"/",$_SERVER['SERVER_NAME']); } } else { $fURL=$HTTP_GET_VARS["perm"]; $fcURL = domen($fURL); if (isset($HTTP_COOKIE_VARS["cURL"])) { $arrURL = $HTTP_COOKIE_VARS["cURL"]; end($arrURL); $y=key($arrURL)+1; }else { $arrURL=array();$y=0; } setcookie ("cURL[$y]", $fcURL, time()+86400,"/",$_SERVER['SERVER_NAME']); } $forFile=$fURL; } if ($forFile != $OUrl){ $filename="statistic".$acc.".txt"; $fp=fopen($filename, "a"); if (filesize($filename) !=0) fwrite($fp, "\r\n".$forFile.";"); else fwrite($fp, $forFile.";"); fclose($fp); } Header("Location:$fURL"); //print ""; ?>