SHARE
TWEET

Untitled

a guest Jan 28th, 2016 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top