Guest User

Untitled

a guest
Feb 7th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. id_User int
  2. password varchar(20)
  3.  
  4. <?php
  5. header('Access-Control-Allow-Origin: *');
  6. header('Access-Control-Allow-Methods: GET, POST');
  7. require_once('../apis/connection.php');
  8.  
  9.  
  10. /*OBTIENE USERS*/
  11. if($_SERVER['REQUEST_METHOD']=='GET')
  12. {
  13. if(isset($_GET['id_user']))
  14. {
  15. $id=$_GET["id_User"];
  16. $pass=$_GET["password"];
  17. $connection = new MySqlServerConnection();
  18.  
  19. $query = 'SELECT id_User, password from users where password=? and user=?';
  20.  
  21. $result=$connection->executeQuery($query, array($id,$pass));
  22.  
  23. if ($result>0)
  24. {
  25. $user = json_encode(array(
  26. 'id_User' => $result[0][0],
  27. 'password' => $result[0][1]));
  28. echo json_encode(array(
  29. 'status' => 0,
  30. 'user' => json_decode($user)
  31. ));
  32. }//CIERRA IF
  33. else
  34. {
  35. echo json_encode(array(
  36. 'status' => 1,
  37. 'errorMessage' => 'user no encontrado'
  38. ));
  39. }//CIERRA ELSE
  40. } //CIERRA IF
  41. }
  42. ?>
Add Comment
Please, Sign In to add comment