summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-18 14:43:29 +0200
committerErich Eckner <git@eckner.net>2018-07-18 14:43:29 +0200
commitceb9911156f67d1c3c6fac001c67ee6358d5b96d (patch)
treef3b3960341ecedd95dae6de1a68941691e71fa60
parent1167ca50449d61ee198e5dfe72bf230ffff1c2ff (diff)
downloadsourceMirror-ceb9911156f67d1c3c6fac001c67ee6358d5b96d.tar.xz
mirror.php: echte http-Fehlercodes zurueckgeben
-rw-r--r--mirror.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/mirror.php b/mirror.php
index 8afc56a..dee5b5c 100644
--- a/mirror.php
+++ b/mirror.php
@@ -19,16 +19,20 @@
$ea = fopen($wurzel."erlaubteAdressen","r");
while (! feof($ea)) {
$zeile = trim(fgets($ea));
- if ($zeile == "") {
- print $_SERVER["REMOTE_ADDR"];
- die();
- }
if ($zeile == $_SERVER["REMOTE_ADDR"])
break;
}
+ if ($zeile != $_SERVER["REMOTE_ADDR"]) {
+ header("Status: 403 Forbidden");
+ print "Error 403: Access Forbidden for " . $_SERVER["REMOTE_ADDR"] . "\n";
+ die();
+ }
- if (substr($quelle,0,1) != "/")
- die("Ung&uuml;ltiger Pfad!");
+ if (substr($quelle,0,1) != "/") {
+ header("Status: 404 Not Found");
+ print "Error 403: Invalid path\n";
+ die();
+ }
$quelle = substr($quelle,1);
@@ -69,5 +73,3 @@
}
exec("find /srv/sourceMirror/ -type f -size 0c -delete");
-
-?>