diff --git a/index.php b/index.php index ed6350f..ff48d31 100755 --- a/index.php +++ b/index.php @@ -2,17 +2,27 @@ // PROXY // Config -$serv = 'servclubinfo.insecure.deule.net'; -$port = 33736; -$root = '/ci_website'; +$serv = 'google.com'; +$port = 80; +$root = ''; +$localRoot = ''; // Functions +function str_replace_once($search, $replace, $subject) { + $pos = strpos($subject, $search); + if ($pos === false) { + return $subject; + } + + return substr($subject, 0, $pos) . $replace . substr($subject, $pos + strlen($search)); +} + if (!function_exists('getallheaders')) { function getallheaders() { if (!is_array($_SERVER)) { return array(); } - + $headers = array(); foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { @@ -26,6 +36,7 @@ if (!function_exists('getallheaders')) { // Target determination $metd = $_SERVER['REQUEST_METHOD']; $reqp = $_SERVER['REQUEST_URI']; +// $reqp = str_replace_once($localRoot, '', $reqp); // Preparing request headers $reqHeds = "$metd $root$reqp HTTP/1.1\r\n"; @@ -53,7 +64,7 @@ if ($metd == 'POST') { // TODO Waaaay too long $fp = fsockopen($serv, $port, $errno, $errstr, 30); if (!$fp) { - echo "Impossible de se connecter au serveur du Club Info :-(\n
$errstr ($errno)
\n"; + echo "Couldn't connect to server\n
$errstr ($errno)
\n"; } else { // Sending request fwrite($fp, $reqHeds); @@ -81,4 +92,4 @@ if (!$fp) { fclose($fp); } -?> \ No newline at end of file +?>