diff --git a/404.html b/404.html
deleted file mode 100644
index 8778804..0000000
--- a/404.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-404 NOT FOUND
-
-Error. File not found !
\ No newline at end of file
diff --git a/config.yml b/config.yml
new file mode 100644
index 0000000..f542ada
--- /dev/null
+++ b/config.yml
@@ -0,0 +1,14 @@
+# Welcome to Online config !
+
+#This define the port that your website that will run.
+#****NOTE THAT YOU WILL NEED TO RE-PORTFOREWARD WITH THE NEW PORT****
+port: 8080
+
+# Here you can choose the pages !
+index: index.html
+404: 404.html
+403: 403.html
+
+# Here you can config pages that user will not be able to see !
+denied-pages:
+ - /config..yml/
\ No newline at end of file
diff --git a/resources/403.html b/resources/403.html
new file mode 100644
index 0000000..87140c9
--- /dev/null
+++ b/resources/403.html
@@ -0,0 +1,5 @@
+
+
+403 FORBIDDEN
+
+Error. You don't have the peremission to view this page or to perform this action !
\ No newline at end of file
diff --git a/resources/config.yml b/resources/config.yml
new file mode 100644
index 0000000..aefe907
--- /dev/null
+++ b/resources/config.yml
@@ -0,0 +1,14 @@
+# Welcome to Online config !
+
+#This define the port that your website that will run.
+#****NOTE THAT YOU WILL NEED TO RE-PORTFOREWARD WITH THE NEW PORT****
+port: 8080
+
+# Here you can choose the pages !
+index: index.html
+404: 404.html
+403: 403.html
+
+# Here you can config pages that user will not be able to see !
+denied-pages:
+ - /config..yml
\ No newline at end of file
diff --git a/src/Ad5001/Online/Main.php b/src/Ad5001/Online/Main.php
index 607c883..b09aa8e 100644
--- a/src/Ad5001/Online/Main.php
+++ b/src/Ad5001/Online/Main.php
@@ -24,10 +24,13 @@ if(!file_exists($this->getDataFolder() . "index.html")) {
if(!file_exists($this->getDataFolder() . "404.html")) {
file_put_contents($this->getDataFolder() . "404.html", $this->getResource("404.html"));
}
+if(!file_exists($this->getDataFolder() . "403.html")) {
+ file_put_contents($this->getDataFolder() . "403.html", $this->getResource("403.html"));
+}
set_time_limit(0);
$address = '0.0.0.0';
-$port = 8080;
+$port = $this->getConfig()->get("port");
$sock = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
$result = socket_bind($sock, $address, $port) or die('Could not bind to address');
diff --git a/src/Ad5001/Online/OnlineTask.php b/src/Ad5001/Online/OnlineTask.php
index fb2fd88..fb39ca6 100644
--- a/src/Ad5001/Online/OnlineTask.php
+++ b/src/Ad5001/Online/OnlineTask.php
@@ -10,6 +10,7 @@ use pocketmine\plugin\Plugin;
use pocketmine\level\Level;
use pocketmine\block\Block;
use pocketmine\Player;
+use pocketmine\utils\Config;
use pocketmine\item\Item;
use pocketmine\utils\TextFormat as C;
use pocketmine\IPlayer;
@@ -22,6 +23,7 @@ use pocketmine\math\Vector3;
$this->sock = $sock;
$this->datapath = $datapath;
$this->isRunning = true;
+ $this->cfg = new Config($datapath . "config.yml", Config::YAML);
}
public function onRun() {
$sock = $this->sock;
@@ -44,11 +46,15 @@ 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, '/');
+ echo $fetchArray[1];
if(file_exists($this->datapath . $file)) {
$Content = file_get_contents($this->datapath . $file);
} else {
$Content = file_get_contents($this->datapath . "404.html");
}
+ if(in_array($file, $this->cfg->get("denied-pages"))) {
+ $Content = file_get_contents($this->datapath . "403.html");
+ }
$output = $Header . $Content;
socket_write($client,$output,strlen($output));
}