Advertisement
Guest User

Untitled

a guest
Jan 28th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. //android.php
  2. <?php
  3. #models
  4. require_once("models/User.php");
  5.  
  6. $json = json_decode(file_get_contents("php://input"));
  7. $username = $json->username;
  8. $password = $json->password;
  9. $login = User::login_js($username,$password);
  10.  
  11. if($login == true) {
  12. echo 'true';
  13. } else {
  14. echo 'false';
  15. }
  16.  
  17. //User.php - model
  18.  
  19. static function login_js($username,$pass) {
  20. $stmt = (new Database())->getConnection()->prepare("SELECT id FROM users WHERE login=? && pass=?");
  21. $stmt->execute(array($username, $pass));
  22. if (($temp = $stmt->fetch()) != false) {
  23. return true;
  24. }
  25. return false;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement