SHARE
TWEET

Untitled

a guest Apr 22nd, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $DB_USER = "id9017346_root";
  4. $DB_PASSWORD = "cartracker";
  5. $DB_HOST = "localhost";
  6. $DB_DATABASE = "id9017346_cartracker";
  7.  
  8. $con = mysqli_connect($DB_HOST,$DB_USER,$DB_PASSWORD,$DB_DATABASE);
  9.  
  10. ?>
  11.  
  12.  
  13.  
  14.  
  15.  
  16. <?php
  17.  
  18. require_once 'DbConnect.php';
  19. if ($_SERVER['REQUEST_METHOD'] == 'GET') {
  20.     $username = $_GET['username'];
  21.     $password = $_GET['password'];
  22.  
  23.     $sql = "SELECT ID,FullName,username,PhoneNumber,completed,role FROM Client WHERE username = '$username' AND password = '$password'";
  24.     $result = mysqli_query($con, $sql);
  25.  
  26.     if (mysqli_num_rows($result) > 0) {
  27.         $row = mysqli_fetch_assoc($result);
  28.         print json_encode($row);
  29.     } else {
  30.         $sql = "SELECT * FROM Admin WHERE username = '$username' AND password = '$password'";
  31.         $result = mysqli_query($con, $sql);
  32.         if (mysqli_num_rows($result) > 0) {
  33.             $row = mysqli_fetch_assoc($result);
  34.             print json_encode($row);
  35.         } else {
  36.             echo 'Invalid Credentials';
  37.         }
  38.     }
  39. }
  40. else
  41.  
  42.    echo 'error';
  43. ?>
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