$value) {
//echo "$header: $value
\n";
if(strtolower($header) == "content-length")
$contentLength = intval($value);
if(strtolower($header) == "content-type")
$contentType = $value;
}
$botstrings1 = array( "sam686 custom web page viewer" );
$randomstr1 = $botstrings1[array_rand($botstrings1)];
//echo $randomstr1;
$header_list = array("Host: bitfighter.org", "User-Agent: " . $randomstr1);
//$postdata = $GLOBALS['HTTP_RAW_POST_DATA'];
//$postdata = file_get_contents("php://input");
if($contentLength != 0)
{
if($_SERVER['REMOTE_ADDR'] != "127.0.0.1")
{
die("POST (submit stuff) is disabled except for one user, at 127.0.0.1");
}
//print_r($headers);
//print_r($_POST);
//print_r($_FILES);
curl_setopt($crl, CURLOPT_POST, 1 );
array_push($header_list, "Content-Length: " . $contentLength);
//echo file_get_contents('php://input');
curl_setopt($crl, CURLOPT_POSTFIELDS, @file_get_contents('php://input') );
//die();
}
// echo @file_get_contents(STDIN);
curl_setopt($crl, CURLOPT_HTTPHEADER, $header_list);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
$ret = curl_exec($crl);
if(curl_getinfo($crl, CURLINFO_CONTENT_TYPE) == NULL)
{
header ("Content-type: text/plain");
$ret = die("Could not connect to server");
}
else
{
header ("Content-type: " . curl_getinfo($crl, CURLINFO_CONTENT_TYPE) );
curl_close($crl);
}
return $ret;
}
function get_number($var1)
{
if(isset($_GET[$var1]))
return $_GET[$var1] + 1 - 1;
else
return 0;
}
if(!isset($_SERVER['PATH_INFO']))
{
header( 'Location: ' . $_SERVER['PHP_SELF'] . '/' ) ;
}
else
{
$url = $_SERVER['PATH_INFO'];
if($_SERVER['QUERY_STRING'] != "")
$url = $url . "?" . $_SERVER['QUERY_STRING'];
// $pagedata = file_get_contents2("67.18.11.81" . $url);
$pagedata = file_get_contents2("199.192.229.168" . $url);
echo $pagedata;
//echo $url . "
";
if(substr($url, 0, 22) == "/forums/viewtopic.php?")
{
$topic_number = get_number("t"); // force number
$start_number = get_number("start");
//echo $topic_number;
if($topic_number != 0)
{
$start_number = intval(($start_number + 9) / 10);
$start_str = "";
if($start_number != 0)
$start_str = "_" . $start_number;
$w = fopen("bf_cache/" . ($topic_number) . "_" . date("ymd") . $start_str . ".html", 'w');
fwrite($w, $pagedata);
fclose($w);
}
}
}
?>