更新 src/index.php

This commit is contained in:
jiangsir 2024-09-12 17:48:36 +08:00
parent 927aec373d
commit 14ec7379f3

View File

@ -14,33 +14,4 @@
</form>
<!-- /source.txt -->
</body>
</html <?php
$flag = "FLAGFLAGFLAG";
$secret = "sGucne9iD0"; // 10 characters long
if(!isset($_POST["username"]) || !isset($_POST["password"])){
exit();
}
$username = $_POST["username"];
$password = $_POST["password"];
if (!empty($_COOKIE["check"])) {
if (urldecode($username) === "admin" && urldecode($password) != "admin") {
if ($_COOKIE["check"] === md5($secret . urldecode($username . $password))) {
echo "Login successful.\n";
die ("The flag is ". $flag);
}
else {
die ("Wrong Cookies. Get out!");
}
}
else {
die ("Admins only");
}
}
setcookie("ahash", md5($secret . urldecode("admin" . "admin")), time() + (60 * 60 * 24 * 7));