-
-
Save key-moon/5f535bb35d70dbe0c57d687e20e86e91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($_COOKIE == null | |
|| !isset($_COOKIE["DataCookie"]) | |
|| !isset($_COOKIE["Signature"])) { | |
echo "Login failed!"; | |
return; | |
} | |
parse_str($_COOKIE["DataCookie"], $parse); | |
if ($parse == null | |
|| !isset($parse["logged_in"]) | |
|| $parse["logged_in"] === "0" | |
|| !isset($parse["id"])) { | |
echo "Login failed : invalid parameters!"; | |
return; | |
} | |
$salt = getenv('SIGNATURE_FLAG'); | |
$data = "logged_in={$parse["logged_in"]}&id={$parse["id"]}"; | |
$signature = md5($salt. $data); | |
if($signature !== $_COOKIE["Signature"]) { | |
echo "Login failed : invalid signature!"; | |
return; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment