Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //android.php
- <?php
- #models
- require_once("models/User.php");
- $json = json_decode(file_get_contents("php://input"));
- $username = $json->username;
- $password = $json->password;
- $login = User::login_js($username,$password);
- if($login == true) {
- echo 'true';
- } else {
- echo 'false';
- }
- //User.php - model
- static function login_js($username,$pass) {
- $stmt = (new Database())->getConnection()->prepare("SELECT id FROM users WHERE login=? && pass=?");
- $stmt->execute(array($username, $pass));
- if (($temp = $stmt->fetch()) != false) {
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement