diff --git a/gab/index.php b/gab/index.php index 8245a7a..03a0de4 100644 --- a/gab/index.php +++ b/gab/index.php @@ -1,14 +1,55 @@ 0, + "ban_until" => 0 +]; + +if (file_exists($file)) { + $data = json_decode(file_get_contents($file), true); +} + +if (time() < $data["ban_until"]) { + die("Verbannen tot " . date("Y-m-d H:i:s", $data["ban_until"])); +} + +if ($_SERVER["REQUEST_METHOD"] === "POST") { + + if ($_POST["password"] === $password) { + + unlink($file); + echo "Ingelogd!"; + exit; + + } else { + + $data["attempts"]++; + + if ($data["attempts"] >= 10) { + $data["ban_until"] = time() + 86400; // 1 dag + } + + file_put_contents($file, json_encode($data)); + } +} +?> + +
+ + +
+