summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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ü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");
-
-?>