Created
March 12, 2020 02:52
-
-
Save DaltonWebDev/d9d73963ea0d66c4cb43b2c17bc5b305 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 | |
header("Content-Type: application/json; charset=utf-8"); | |
$username = $_POST["username"]; | |
$wehatepasswordsJson = $_POST["wehatepasswordsJson"]; | |
if (empty($username)) { | |
$error = "Please enter your username."; | |
} else if ($username !== "test") { | |
$error = "This is a demo. Please enter test for the username."; | |
} else if (empty($wehatepasswordsJson)) { | |
$error = "Please enter your password."; | |
} | |
// At this point in script you'd compare with the pixel art JSON you saved on your server, this is just test data (it's a hollow red square) | |
else if ($wehatepasswordsJson !== '[{"number":1,"color":"red"},{"number":2,"color":"red"},{"number":3,"color":"red"},{"number":4,"color":"red"},{"number":5,"color":"red"},{"number":6,"color":"red"},{"number":10,"color":"red"},{"number":11,"color":"red"},{"number":15,"color":"red"},{"number":16,"color":"red"},{"number":20,"color":"red"},{"number":21,"color":"red"},{"number":22,"color":"red"},{"number":23,"color":"red"},{"number":24,"color":"red"},{"number":25,"color":"red"}]') { | |
$error = "The password you entered was incorrect. Please draw a red square around the edge, but don't fill it in."; | |
} else { | |
$error = false; | |
} | |
echo json_encode([ | |
"error" => $error | |
]); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment