Advertisement
selvalives

Untitled

Dec 12th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2.  
  3. include 'includes/db.php';
  4.  
  5. // Check whether username or password is set from android
  6. if(isset($_POST['username']) && isset($_POST['password']) && isset($_POST['fullname']))
  7. {
  8. // Innitialize Variable
  9. $result='';
  10. $fullname = $_POST['fullname'];
  11. $username = $_POST['username'];
  12. $password = $_POST['password'];
  13. $mobile = $_POST['mobile'];
  14. $make = $_POST['make'];
  15. $model = $_POST['model'];
  16. $rn = $_POST['rn'];
  17.  
  18. // Query database for row exist or not
  19. $sql='insert into users(fullname,username,password) values(:fullname,:username,:password)';
  20. //$sql = 'SELECT * FROM users WHERE username = :username AND password = :password';
  21. $stmt = $conn->prepare($sql);
  22. $stmt->bindParam(':fullname', $fullname, PDO::PARAM_STR);
  23. $stmt->bindParam(':username', $username, PDO::PARAM_STR);
  24. $stmt->bindParam(':password', $password, PDO::PARAM_STR);
  25. if ($stmt->execute())
  26. {
  27. $result=['status'=>'true'];
  28. }
  29. else
  30. {
  31. $result=['status'=>'false'];
  32. }
  33. // send result back to android
  34. echo json_encode($result);
  35. }
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement