Advertisement
Guest User

ERROR

a guest
Nov 7th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. require_once 'include/DB_Functions.php';
  5. $db = new DB_Functions();
  6.  
  7. $response = array("error" => FALSE);
  8.  
  9. if (isset($_POST['email']) && isset($_POST['password'])) {
  10.  
  11.     $email = $_POST['email'];
  12.     $password = $_POST['password'];
  13.  
  14.     $user = $con->getUserByEmailAndPassword($email, $password);
  15.  
  16.     if ($user != false) {
  17.  
  18.         $response["error"] = FALSE;
  19.         $response["uid"] = $user["unique_id"];
  20.         $response["user"]["name"] = $user["name"];
  21.         $response["user"]["email"] = $user["email"];
  22.         $response["user"]["created_at"] = $user["created_at"];
  23.         $response["user"]["updated_at"] = $user["updated_at"];
  24.         echo json_encode($response);
  25.     } else {
  26.    
  27.         $response["error"] = TRUE;
  28.         $response["error_msg"] = "Login credentials are wrong. Please try again!";
  29.         echo json_encode($response);
  30.     }
  31. } else {
  32.    
  33.     $response["error"] = TRUE;
  34.     $response["error_msg"] = "Required parameters email or password is missing!";
  35.     echo json_encode($response);
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement