mirror of
https://github.com/GeoffreyFrogeye/phroxyp.git
synced 2024-11-21 19:36:04 +01:00
Merge branch 'gitServ'
This commit is contained in:
commit
4c89cb0cbf
19
index.php
19
index.php
|
@ -2,11 +2,21 @@
|
||||||
|
|
||||||
// PROXY
|
// PROXY
|
||||||
// Config
|
// Config
|
||||||
$serv = 'servclubinfo.insecure.deule.net';
|
$serv = 'google.com';
|
||||||
$port = 33736;
|
$port = 80;
|
||||||
$root = '/ci_website';
|
$root = '';
|
||||||
|
$localRoot = '';
|
||||||
|
|
||||||
// Functions
|
// 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')) {
|
if (!function_exists('getallheaders')) {
|
||||||
function getallheaders() {
|
function getallheaders() {
|
||||||
if (!is_array($_SERVER)) {
|
if (!is_array($_SERVER)) {
|
||||||
|
@ -26,6 +36,7 @@ if (!function_exists('getallheaders')) {
|
||||||
// Target determination
|
// Target determination
|
||||||
$metd = $_SERVER['REQUEST_METHOD'];
|
$metd = $_SERVER['REQUEST_METHOD'];
|
||||||
$reqp = $_SERVER['REQUEST_URI'];
|
$reqp = $_SERVER['REQUEST_URI'];
|
||||||
|
// $reqp = str_replace_once($localRoot, '', $reqp);
|
||||||
|
|
||||||
// Preparing request headers
|
// Preparing request headers
|
||||||
$reqHeds = "$metd $root$reqp HTTP/1.1\r\n";
|
$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);
|
$fp = fsockopen($serv, $port, $errno, $errstr, 30);
|
||||||
if (!$fp) {
|
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 {
|
} else {
|
||||||
// Sending request
|
// Sending request
|
||||||
fwrite($fp, $reqHeds);
|
fwrite($fp, $reqHeds);
|
||||||
|
|
Loading…
Reference in a new issue