From 03643fb4af9406e355927437c962cbfae4be53e0 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Tue, 31 May 2016 18:46:19 +0200 Subject: [PATCH] FINALLY ADDING $_GET METHOD --- src/Ad5001/Online/OnlineTask.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/Ad5001/Online/OnlineTask.php b/src/Ad5001/Online/OnlineTask.php index cc30a9a..928dc19 100644 --- a/src/Ad5001/Online/OnlineTask.php +++ b/src/Ad5001/Online/OnlineTask.php @@ -47,8 +47,27 @@ use pocketmine\math\Vector3; "Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . "Content-Type: text/html \r\n\r\n"; $file = ltrim($file, '/'); + if(strpos($file, "?")) { + $exe = explode("?", $file); + $file = $exe[0]; + $exe = explode("&", $exe[1]); + } + if(file_exists($this->datapath . $file)) { if(pathinfo($this->datapath . $file)['extension'] === "php") { + if(isset($exe[0])) { + $GET = []; + foreach($exe as $exes) { + $ex = explode("=", $exes); + array_push($GET, "\"{$ex[0]}\" => \"{$ex[1]}\""); + } + $current = '' . file_get_contents($this->datapath . $file); + $current = str_ireplace('$_GET', '$GET', $current); + file_put_contents($this->datapath . "current.php", $current); + $file = "current.php"; + } ob_start(); include $this->datapath . $file ; $Content = ob_get_contents(); @@ -57,19 +76,19 @@ use pocketmine\math\Vector3; $Content = file_get_contents($this->datapath . $file); } $Header = "HTTP/1.1 200 OK \r\n" . - "Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . - "Content-Type: text/html \r\n\r\n"; +"Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . +"Content-Type: text/html \r\n\r\n"; } else { $Header = "HTTP/1.1 404 NOT FOUND \r\n" . - "Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . - "Content-Type: text/html \r\n\r\n"; +"Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . +"Content-Type: text/html \r\n\r\n"; $Content = file_get_contents($this->datapath . $this->cfg->get("404")); } foreach($this->cfg->get("denied-pages") as $dp) { if($dp === $file) { $Header = "HTTP/1.1 403 FORBIDDEN \r\n" . - "Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . - "Content-Type: text/html \r\n\r\n"; +"Date: Fri, 31 Dec 1999 23:59:59 GMT \r\n" . +"Content-Type: text/html \r\n\r\n"; $Content = file_get_contents($this->datapath . $this->cfg->get("403")); } }