Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'includes/db.php';
- // Check whether username or password is set from android
- if(isset($_POST['username']) && isset($_POST['password']))
- {
- // Innitialize Variable
- $result='';
- $username = $_POST['username'];
- $password = $_POST['password'];
- //$username = 'selva';
- //$password = 'password';
- // Query database for row exist or not
- $sql = 'SELECT userid,fullname,rn FROM users WHERE username = :username AND password = :password';
- $stmt = $conn->prepare($sql);
- $stmt->bindParam(':username', $username, PDO::PARAM_STR);
- $stmt->bindParam(':password', $password, PDO::PARAM_STR);
- $stmt->execute();
- if($stmt->rowCount())
- {
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
- {
- $result=['status'=>'true','userid'=>$row['userid'],'fullname'=>$row['fullname'],'rn'=>$row['rn']];
- }
- }
- elseif(!$stmt->rowCount())
- {
- $result=['status'=>'false'];
- }
- // send result back to android
- echo json_encode($result);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement