mirror of
https://github.com/GeoffreyFrogeye/phroxyp.git
synced 2024-11-20 19:26:03 +01:00
Merge branch 'gitServ'
This commit is contained in:
commit
4c89cb0cbf
19
index.php
19
index.php
|
@ -2,11 +2,21 @@
|
|||
|
||||
// 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)) {
|
||||
|
@ -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<br/>$errstr ($errno)<br />\n";
|
||||
echo "Couldn't connect to server\n<br/>$errstr ($errno)<br />\n";
|
||||
} else {
|
||||
// Sending request
|
||||
fwrite($fp, $reqHeds);
|
||||
|
|
Loading…
Reference in a new issue