SHARE
TWEET

Untitled

a guest Jul 21st, 2019 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ShowDriverRecord($userName, $password) {
  2.     global $connect;
  3.     $query = "SELECT drv_id,drv_firstname,drv_surname FROM wp_booking_drivers WHERE drv_username = '$userName' AND drv_password = '$password'";
  4.     $result = mysqli_query($connect,$query);
  5.     $no_of_rows = mysqli_num_rows($result);
  6.  
  7.     $status = false;
  8.     $driverId = null;
  9.     $driverName = null;
  10.  
  11.     if ($no_of_rows > 0) {
  12.         $driverRecord = mysqli_fetch_assoc($result);
  13.         $status = true;
  14.         $driverId = $driverRecord['drv_id'];
  15.         $driverName = $driverRecord['drv_firstname']." ".$driverRecord['drv_surname'];
  16.     }
  17.  
  18.     header('Content-Type: application/json');
  19.     echo json_encode(array("Status"=>$status,"DriverId"=>$driverId,"DriverName"=>$driverName));
  20. }
  21.      
  22. Map<String,String> params = new HashMap<>();
  23.     params.put("userName",username);
  24.     params.put("password",password);
  25.     CustomJsonRequest jsonRequest = new CustomJsonRequest(Request.Method.POST, WebUrls.DRIVER_LOGIN_URL, params, new Response.Listener<JSONObject>() {
  26.         @Override
  27.         public void onResponse(JSONObject response) {
  28.             try {
  29.                 boolean status = response.getBoolean("Status");
  30.                 if (status){
  31.                     callbacks.onSuccess(response);
  32.                 }else {
  33.                     callbacks.onFailure("Wrong username or password.");
  34.                 }
  35.             } catch (JSONException e) {
  36.                 e.printStackTrace();
  37.             }
  38.         }
  39.     }, new Response.ErrorListener() {
  40.     @Override
  41.     public void onErrorResponse(VolleyError error) {
  42.         error.printStackTrace();
  43.     }
  44. });
  45. requestQueue.add(jsonRequest);
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top