diff options
author | Erich Eckner <git@eckner.net> | 2018-07-18 14:43:29 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-18 14:43:29 +0200 |
commit | ceb9911156f67d1c3c6fac001c67ee6358d5b96d (patch) | |
tree | f3b3960341ecedd95dae6de1a68941691e71fa60 | |
parent | 1167ca50449d61ee198e5dfe72bf230ffff1c2ff (diff) | |
download | sourceMirror-ceb9911156f67d1c3c6fac001c67ee6358d5b96d.tar.xz |
mirror.php: echte http-Fehlercodes zurueckgeben
-rw-r--r-- | mirror.php | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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ü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"); - -?> |