Created
June 30, 2015 17:59
-
-
Save dmnugent80/0eb1362a4a7837740b96 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
// array for JSON response | |
$response = array(); | |
// check for required fields | |
if (isset($_POST['name']) && isset($_POST['password'])) { | |
$name = $_POST['name']; | |
$message = $_POST['message']; | |
$response["success"] = 1; | |
$response["message"] = "Login successful."; | |
// echoing JSON response | |
print(json_encode($response)); | |
} else { | |
// required field is missing | |
$response["success"] = 0; | |
$response["message"] = "Required field(s) is missing"; | |
// echoing JSON response | |
print(json_encode($response)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment