<?php
// Copyright (C) 2006 Bruce Clement
// You may use this under the terms of the GPL version 3
$startServer = $_SERVER["SERVER_NAME"];
if ($startServer=="") {$startServer =$_SERVER["HTTP_HOST"];}
$namedrive="http://www.ndparking.com/";
$trafficz="http://landing.trafficz.com/index.php?domain=";
$oneplus="http://www.1plus.net/";
srand( ((int)((double)microtime()*1000003)) );
$sel=rand( 0,1);
switch( $sel )
{
case 0:
$target=$oneplus;
break;
default:
$target=$namedrive;
break;
}
$domain=str_replace("www.","",strtolower($startServer));
$targe2="$domain";
$targe3="";
if (stristr($domain,"school.nz")) {$target=$namedrive;}
if (stristr($domain,".ac.nz")) {$target=$oneplus;}
if (stristr($domain,".gen.nz")) {$target=$oneplus;}
switch( $domain ) {
case "DOMAIN1.co.nz":
$target=$namedrive;
break;
case "DOMAIN2.co.nz":
$target=$trafficz;
break;
default:
break;
}
if( $target==$trafficz ) {$target = $namedrive;}
if( $target==$oneplus ) {$targe3 = "/";}
if (!stristr($domain,"Where-the-script-is.com"))
{
$host=$_SERVER['REMOTE_ADDR'];
$ident=$_SERVER['REMOTE_IDENT'];
$auth=$_SERVER['REMOTE_USER'];
$timeStamp=date("d/M/Y:H:i:s O");
$reqType=$_SERVER['REQUEST_METHOD'];
$servProtocol=$_SERVER['SERVER_PROTOCOL'];
$userAgent=$_SERVER['HTTP_USER_AGENT'];
$referrer=$_SERVER['HTTP_REFERER'];
$fileName=$_SERVER['REQUEST_URI'];
$fileSize="92";
$statusCode="200";
if ($host==""){ $host="-"; }
if ($ident==""){ $ident="-"; }
if ($auth==""){ $auth="-"; }
if ($reqType==""){ $reqType="-"; }
if ($servProtocol==""){ $servProtocol="-"; }
if ($userAgent==""){ $userAgent="-"; }
if ($referrer==""){ $referrer="-"; }
if ($fileName=="" || stristr($userAgent,"gigablast")){ $fileName="/"; }
// Create CLF formatted string
$clfString=$host." ".$ident." ".$auth." [".$timeStamp."] \"".$reqType." ".$fileName." ".$servProtocol."\" ".$statusCode." ".$fileSize." \"".$referrer."\" \"".$userAgent."\"\n";
if( $host != "223.132.212.226" )
{
$logFile = $_SERVER["DOCUMENT_ROOT"] . "/../mylogs/".$domain."-".date("Ym").".log";
if (file_exists($logFile)){
// If YES, Open Existing Log File
$fileWrite = fopen($logFile,"a");}
else {
// If NO, Create a New Log File
$fileWrite = fopen($logFile,"w");
}
flock($fileWrite, LOCK_SH);
fwrite($fileWrite,$clfString);
flock($fileWrite, LOCK_UN);
fclose($fileWrite);
if( 1 ) {
$log2=$_SERVER["DOCUMENT_ROOT"] . "/../mylogs/info.txt";
if (file_exists($log2)){
// If YES, Open Existing Log File
$file2 = fopen($log2,"a");
} else {
$file2 = fopen($log2,"w");
}
flock($file2, LOCK_SH);
$clfString = $target . $targe2 . $targe3 . "\n";
fwrite($file2, $clfString );
flock($file2, LOCK_UN);
fclose($file2);
}
}
header("HTTP/1.1 302 Found");
header("Location: $target$targe2$targe3");
exit();
}
?>
<html>
<body>
<?php
echo "startServer: " . $startServer . "<br />";
echo "target: " . $target . "<br />";
echo "targe2: " . $targe2 . "<br />";
echo "Host: " . $_SERVER["HTTP_HOST"] . "<br />";
echo "Server Name: " . $_SERVER["SERVER_NAME"] . "<br />";
echo "Request uri: " . $_SERVER["REQUEST_URI"] . "<br />";
echo "Referer: " . $_SERVER["HTTP_REFERER"] . "<br />";
echo "Script Name: " . $_SERVER["SCRIPT_NAME"] . "<br />";
echo "Query String: " . $_SERVER["QUERY_STRING"] . "<br />";
echo "Browser: " . $_SERVER["HTTP_USER_AGENT"] . "<br />";
echo "User's IP address: " . $_SERVER["REMOTE_ADDR"] . " " . $_SERVER["HTTP_X_FORWARDED_FOR"] . "<br />";
?>
</body>
</html>