MMCT TEAM
Server IP : 82.112.239.40  /  Your IP : 3.17.182.90
Web Server : LiteSpeed
System : Linux in-mum-web1676.main-hosting.eu 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
User : u641149403 ( 641149403)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u641149403/domains/cabz4you.com/public_html/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u641149403/domains/cabz4you.com/public_html/local-rental-result.php
<?php include('include/common.php');
if(isset($_SESSION['oneway'])){
  $session = $_SESSION['oneway'];
  $origin = $session['o'];
  $destination = $session['d'];
  $pickup_date = $session['pickup_date'];
  $pickup_time = $session['pickup_time'];
  $lat = $session['lat'];
  $long = $session['long'];
  $trip_type = $session['trip_type'];
  $mobile = $session['mobile'];
}else{
  header('location:'.BASE_URL);
}

$formatted_pickupdate = date('D jS M Y', strtotime($pickup_date));
?>
<!DOCTYPE html>
<html lang="en" style="overflow-x:hidden">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="msapplication-TileColor" content="#ffffff">
  <meta name="msapplication-TileImage" content="../ms-icon-144x144.html">
  <meta name="theme-color" content="#ffffff">
  <title>Local Rental Booking - <?=SITE_NAME?></title>
  <?php
  include "include/header.php";
  $current_date= date("Y-m-d h:i:s");

  if ($pickup_date===date('Y-m-d')) { ?>
    <style>
      .time2{
        display: none;
      }
    </style>
  <?php }else{ ?>
    <style>
      .time1{
        display: none;
      }
    </style>
  <?php }
  ?>

  
  <section class="search-details">
    <div class="container">
      <div class="card locationbox">
        <ul class="list-unstyled locationstyle">
          <li class="pick-up"><span><?=$origin; ?><br>
            <span class="display_none_phone">( <?=$formatted_pickupdate?> <?=$pickup_time?> )</span></span></li>
            <li class="icon"><div><i class="fa fa-chevron-right"></i></div></li>
            <li class="droploc"><span><?=$destination; ?><br><span class="display_none_phone">( <?=$formatted_pickupdate?> 11:59 PM )</span></span></li>
          </ul>
        </div>

        <div class="head">
          <p><span class="d-lg-none"><?=$formatted_pickupdate?> <?=$pickup_time?></span></p>
          <button type="button" class="btn-theme" data-toggle="modal" data-backdrop="false" data-target="#myModal"><i class="fa fa-pencil-square-o"></i> Modify</button>
        </div>
      </div>
    </section>


    <!-- ===============modal form============= -->

    <div class="modal fade" id="myModal" role="dialog" style="z-index: 10000000;">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
          </div>
          <form method="POST" action="recent_form_submision.php">
            <h4 class="form-heading">Oneway Trip</h4>

            <input type="hidden" name="trip_type" value="One Way">
            <input type="hidden" name="mobile" value="<?=$mobile?>">
            <input type="hidden" name="lat" id="lat">
            <input type="hidden" name="long" id="long">

            <div class="form-group row">
              <div class="col-md-3">
                <label>From:</label>
              </div>
              <div class="col-md-9">
                <input required type="text" class="form-control" placeholder="Start Typing City" id="autocomplete" name="o" value="<?php echo $origin; ?>">
                <div class="exchange"><i class="fa fa-exchange" onclick="swipe_from_to('autocomplete','autocomplete2')"></i></div>
              </div>
            </div>

            <div class="form-group row">
              <div class="col-md-3">
                <label>To:</label>
              </div>
              <div class="col-md-9">
                <input required type="text" class="form-control" placeholder="Start Typing City" id="autocomplete2" name="d" value="<?php echo $destination; ?>">
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-6"> 
                <label>Pick Up:</label>
                <input type="date" required class="date form-control" placeholder="Pickup Date" min="<?php echo date('Y-m-d'); ?>" id="out_pick_date" name="pickup_date" value="<?php echo $pickup_date; ?>">
              </div>

              <div class="col-md-6"> 
                <label>Pick At:</label>
                <select class="form-control" name="pickup_time" id="time" placeholder="Time" required>
                  <?php 
                  $q = "select * from time_slots";
                  $query = mysqli_query($db,$q);
                  while($time = mysqli_fetch_array($query)) {
                    $start = strtotime($time['opening_time']);
                    $end = strtotime($time['closing_time']);
                    $timeSlot = $time['time_slot'];
                    for ($i=$start; $i<$end; $i = $i + $timeSlot*60){
                      $timeFrom = date('h:i A',$i);
                      $timeTo = date('h:i A',strtotime('+'.$timeSlot.'minutes',strtotime($timeFrom)));
                      ?>
                      <?php
                      date_default_timezone_set('Asia/Kolkata');
                      $timestamp = strtotime(date('H:i')) + 60*60;
                      $currentTime = strtotime(date('h:i A', $timestamp));
                      if($currentTime <= strtotime($timeFrom)){ ?>
                        <option value="<?php echo $timeFrom; ?>" <?php if($pickup_time==$timeFrom){echo 'selected';} ?> class="time1"><?php echo $timeFrom; ?></option>
                      <?php } ?>
                      <option value="<?php echo $timeFrom; ?>" <?php if($pickup_time==$timeFrom){echo 'selected';} ?> class="time2"><?php echo $timeFrom; ?></option>
                    <?php } } ?>
                  </select>
                </div>
              </div>
              <div class="text-center ">
                <input type="submit" class="btn btn-theme" name="submit" value="Select Car" />
              </div>
            </form>
          </div>
        </div>
      </div>

      <!-- ===============modal form============= -->

      <div class="bg-background" style="padding-top: 4px;background-color: ;">

        <!-- ===========not working cities===================== -->
        <?php
        $show = "SELECT * FROM not_working_cities";
        $result = $db->query($show);
        if ($result->num_rows > 0) {
          while ($row = $result->fetch_assoc()) {
            $state[] = $row;
          }
        }
        foreach ($state as $cities) {
          $city_exclude = $cities['city'];
          if (preg_match("/{$city_exclude}/i", $origin) || preg_match("/{$city_exclude}/i", $destination)) {
            $match = 'true';
          }
        }
        ?>
        <?php if ($match == 'true') { ?>
          <div class="text-center">
            <img src="images/empty.gif" class="img-fluid" style="height: 400px;">
            <h3>Service not Available in this City</h3>
            <p>Please try a valid search</p>
          </div>
          <style>
            .cab-price-section {
              display: none;
            }
          </style>
        <?php } ?>
        <!-- ===========not working cities===================== -->

        <!--cab type-->
        <?php
        $api = file_get_contents("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=" . urlencode($origin) .
          "&destinations=" . urlencode($destination) . "&key=".$google_key);
        $data = json_decode($api);
        $distances = round(((int)$data->rows[0]->elements[0]->distance->value / 1000));
        $distance=$distances;

          // if ($distances>=250) {
          //   $distance=$distances;
          // }else{
          //   $distance=250;
          // }


        $time = $data->rows[0]->elements[0]->duration->text;

        $sql2 = "SELECT * FROM cab_types ORDER BY cab_types.indexing ASC";
                // $sql = "SELECT rentalcar.*, cab_types.* FROM rentalcar INNER JOIN cab_types ON rentalcar.id=cab_types.id";
                // print_r($origin);
        $search_hisar = 'Hisar';
        if (preg_match("/{$search_hisar}/i", $origin)) {
          $origin_hisar = 'Hisar, Haryana, India';
        }
        $search = 'Hisar';
        if (preg_match("/{$search}/i", $destination)) {
          $hisar_destination = 'Hisar, Haryana, India';
        }
        $result2 = mysqli_query($db, $sql2);
        $tabs_result = mysqli_query($db, $sql2);




        $from_hisar = mysqli_query($db, "SELECT * FROM `no_return_cities` WHERE city ='$origin_hisar'");
        $from_hisar = mysqli_fetch_assoc($from_hisar);
        $Checker = $from_hisar['city'];
        $price_km = $from_hisar['price_km'];
        if ($price_km==0) {
          $price_km = $from_hisar['low_price'];
        }
        $sql3 = mysqli_query($db, "SELECT * FROM `no_return_cities` WHERE city ='$hisar_destination'");
        $sql3 = mysqli_fetch_assoc($sql3);
        $destination_hisar = $sql3['city'];
        $hisar_price_km = $sql3['price_km'];
        if ($hisar_price_km==0) {
          $hisar_price_km = $sql3['low_price'];
        }
        $sql = "SELECT * FROM `no_return_cities` ";
        $result = mysqli_query($db, $sql);
                        // echo $result->num_rows;
        $cab_type_id=array();
                        $cab_type_ids=array(); //Cab_Names (ARRAY)
                        $match_city_price=array();  //Cab_Price (ARRAY)
                        while ($city = mysqli_fetch_array($result)){
                          $priceNew=$city['price_km'];
                          if ($priceNew==0) {
                            $priceNew=-$city['low_price'];
                          }
                          $check = $city['city'];
                          $city_check = explode(":", $check);
                          if (preg_match("/{$city_check[0]}/i", $origin) && preg_match("/{$city_check[1]}/i", $destination)) {
                            $temp_array=explode(",", $city['cab_type_id']);
                            foreach ($temp_array as $key) {
                              array_push($cab_type_ids, $key);
                            }
                            for ($i=0; $i < count($temp_array); $i++)  array_push($match_city_price, $priceNew);
                          }
                        }
                        ?>
                        <section class="cab-price-section">
                          <div class="container">
                            <ul class="nav nav-tabs d-lg-none" id="myTab" role="tablist">

                              <?php $i=1; while ($tab = mysqli_fetch_array($tabs_result)) {
                                if ($i==1) {
                                  $active = 'active';
                                }else{
                                  $active='';
                                }

                               // distance fare
                                $distance_fare = mysqli_query($db, "SELECT * FROM distance_fare INNER JOIN distance_fare_cab ON distance_fare.id=distance_fare_cab.distance_fare_id WHERE km_from<=".$distance." AND km_to>=".$distance." AND cab_typeid='".$tab['id']."'");
                                if(mysqli_num_rows($distance_fare)){
                                  $distance_fare_price = mysqli_fetch_assoc($distance_fare);
                                  // print_r($distance_fare_price);
                                }else{
                                  $distance_fare_price = 0;
                                }
                                // distance fare

                                // discounted price
                                if ($distance_fare_price==0) { 
                                  if (in_array($tab['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                    $pos=array_search($tab['type'], $cab_type_ids);
                                    $discounted_price = round($rate = ($tab['price'] + $match_city_price[$pos]) * $distance, 2);
                                  } else {
                                    $discounted_price = round($rate = $tab['price'] * $distance, 2);
                                  }
                                }
                                else{
                                  if (in_array($tab['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                    $pos=array_search($tab['type'], $cab_type_ids);
                                    $discounted_price = round($rate = ($distance_fare_price['price'] + $match_city_price[$pos]) * $distance, 2);
                                  } else {
                                    $discounted_price = round($distance_fare_price['price']*$distance,2);
                                  }
                                }
                                // discounted price
                                ?>
                                <!-- tabs -->
                                <li class="nav-item">
                                  <a class="nav-link <?=$active?>" data-toggle="tab" href="#tabs-<?=$i?>" role="tab">
                                    <p><?php echo $tab['type']; ?></p>
                                    <img src="admin/<?php echo $tab['img'] ?>">
                                    <p>₹<?=$discounted_price?></p>
                                  </a>
                                </li>
                                <!-- tabs -->
                                <?php $i++; } ?>
                              </ul>
                              <!-- tabs end -->

                              <div class="tab-content">
                                <?php $i=1; while ($row2 = mysqli_fetch_array($result2)) {
                                  if ($i==1) {
                                    $active = 'active';
                                  }else{
                                    $active='';
                                  }
                                // distance fare
                                  $distance_fare = mysqli_query($db, "SELECT * FROM distance_fare INNER JOIN distance_fare_cab ON distance_fare.id=distance_fare_cab.distance_fare_id WHERE km_from<=".$distance." AND km_to>=".$distance." AND cab_typeid='".$row2['id']."'");
                                  if(mysqli_num_rows($distance_fare)){
                                    $distance_fare_price = mysqli_fetch_assoc($distance_fare);
                                  // print_r($distance_fare_price);
                                  }else{
                                    $distance_fare_price = 0;
                                  }
                                // distance fare

                                  if (in_array($row2['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                    $pos=array_search($row2['type'], $cab_type_ids); 
                                    $price_rs = $rate = ($row2['price'] + $match_city_price[$pos]) * $distance;
                                  } else {
                                    $price_rs = $rate = $row2['price'] * $distance;
                                  }

                              // base price extra
                                  if ($distance_fare_price==0) {   
                                    if ($row2['extra_price'] != 0) {

                                      if ($row2['extra_price'] != 0) {
                                        if (in_array($row2['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                          $pos=array_search($row2['type'], $cab_type_ids);
                                          $price_rs_extra=$rate = ($row2['extra_price'] + $match_city_price[$pos]) * $distance;
                                          $base_price = round($price_rs_extra, 2);
                                        } else {
                                          $price_rs_extra=$rate = $row2['extra_price'] * $distance;
                                          $base_price = round($price_rs_extra, 2);
                                        }
                                      } else {
                                        $base_price = '';
                                      }
                                    } 
                                  }else{ 

                                    if (in_array($row2['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                      $pos=array_search($row2['type'], $cab_type_ids);
                                      $price_rs_extra=$rate = ($distance_fare_price['extra_price'] + $match_city_price[$pos]) * $distance;
                                      $base_price = round($price_rs_extra, 2);
                                    } else {
                                      $price_rs_extra=$rate = $distance_fare_price['extra_price'] * $distance;
                                      $base_price = round($price_rs_extra, 2);
                                    }
                                  }
                              // base price extra

                                // discounted price
                                  if ($distance_fare_price==0) { 
                                    if (in_array($row2['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                      $pos=array_search($row2['type'], $cab_type_ids);
                                      $discounted_price = round($rate = ($row2['price'] + $match_city_price[$pos]) * $distance, 2);
                                    } else {
                                      $discounted_price = round($rate = $row2['price'] * $distance, 2);
                                    }
                                  }
                                  else{
                                    if (in_array($row2['type'], $cab_type_ids) || $cab_type_id == 'all') {
                                      $pos=array_search($row2['type'], $cab_type_ids);
                                      $discounted_price = round($rate = ($distance_fare_price['price'] + $match_city_price[$pos]) * $distance, 2);
                                    } else {
                                      $discounted_price = round($distance_fare_price['price']*$distance,2);
                                    }
                                  }
                                // discounted price

                                    // extra after/km
                                  if ($distance_fare_price==0) { 
                                    $extra_after_km = $row2['extra_afterkms'];
                                  }else{
                                    $extra_after_km = $distance_fare_price['extra_price'];
                                  }

                                  $percentage = ($discounted_price / $base_price) * 100;
                                  $percentage = 100-$percentage;
                                  ?>
                                  <div class="tab-pane p-3 <?=$active?>" id="tabs-<?=$i?>" role="tabpanel">
                                    <form method="POST" action="final_form_submit.php">
                                      <input type="hidden" name="distance" value="<?php echo $distance; ?>" />
                                      <input type="hidden" name="mobile" value="<?=$mobile?>">
                                      <input type="hidden" name="time" value="<?php echo $time; ?>" />
                                      <input type="hidden" name="o" value="<?php echo $origin; ?>" />
                                      <input type="hidden" name="d" value="<?php echo $destination; ?>" />
                                      <input type="hidden" name="pickup_date" value="<?php echo $pickup_date; ?>" />
                                      <input type="hidden" name="pickup_time" value="<?php echo $pickup_time; ?>" />
                                      <input type="hidden" name="dis" value="<?php echo round($distances); ?>" />
                                      <input type="hidden" name="time" value="<?php echo $time; ?>" />
                                      <input type="hidden" name="lat" value="<?php echo $lat; ?>" />
                                      <input type="hidden" name="long" value="<?php echo $long; ?>" />
                                      <input type="hidden" name="extra_km" value="<?php echo $extra_after_km?>" />
                                      <input type="hidden" name="rate" value="<?=$discounted_price?>" />
                                      <input type="hidden" name="trip_type" value="<?=$trip_type?>" />

                                      <div class="position-relative phone-offer-badge d-lg-none mt-3">
                                        <?php if ($percentage>0) { ?>
                                          <div class="offer-tag">
                                            <img src="images/offer-badge.png"><p><?=round($percentage,2)?> %<br> OFF</p>
                                          </div>
                                        <?php } ?>
                                        <div class="cab-card-phone">
                                          <div class="cab-name"><?php echo $row2['type']; ?></div>
                                          <div class="d-flex">
                                            <div class="cab-card-body">
                                              <div class="cab-price">
                                                <div class="price">₹ <?=$discounted_price?></div>
                                                <?php if($base_price>$discounted_price){ ?>
                                                  <div class="base-price"><del>₹ <?=$base_price?></del> </div>
                                                  <div class="save-price">Save ₹ <?=$base_price-$discounted_price?> </div>
                                                <?php } ?>
                                              </div>
                                            </div>
                                            <div class="card-img">
                                              <img src="admin/<?php echo $row2['img'] ?>">
                                            </div>
                                          </div>
                                          <ul>
                                            <li><i class="fa fa-check"></i><span class="text-danger">Free Cancellation</span> till 4 hours of departure.</li>
                                            <li><i class="fa fa-check"></i>100% Verified Drivers.</li>
                                            <li class="text-success"><i class="fa fa-check"></i>Best Price Guaranteed.</li>
                                            <li><i class="fa fa-check"></i> <?=$distance;?> km Included</li>
                                            <li class="text-danger"><i class="fa fa-check"></i><?=$extra_after_km?>/Km After <?=$distance;?> Kms.</li>
                                          </ul>

                                          <div class="select-btn">
                                            <button type="submit" class="btn-theme w-100" name="cab_cat_id" value="<?=$row2['id']; ?>">Select</button>
                                          </div>
                                        </div>
                                      </div>
                                    </form>
                                  </div>

                                  <div class="position-relative">
                                    <div class="border-box">
                                      <form method="POST" action="final_form_submit.php">
                                        <input type="hidden" name="distance" value="<?php echo $distance; ?>" />
                                        <input type="hidden" name="mobile" value="<?=$mobile?>">
                                        <input type="hidden" name="time" value="<?php echo $time; ?>" />
                                        <input type="hidden" name="o" value="<?php echo $origin; ?>" />
                                        <input type="hidden" name="d" value="<?php echo $destination; ?>" />
                                        <input type="hidden" name="pickup_date" value="<?php echo $pickup_date; ?>" />
                                        <input type="hidden" name="pickup_time" value="<?php echo $pickup_time; ?>" />
                                        <input type="hidden" name="dis" value="<?php echo round($distances); ?>" />
                                        <input type="hidden" name="time" value="<?php echo $time; ?>" />
                                        <input type="hidden" name="lat" value="<?php echo $lat; ?>" />
                                        <input type="hidden" name="long" value="<?php echo $long; ?>" />
                                        <input type="hidden" name="extra_km" value="<?php echo $extra_after_km?>" />
                                        <input type="hidden" name="rate" value="<?=$discounted_price?>" />
                                        <input type="hidden" name="trip_type" value="<?=$trip_type?>" />
                                        <?php if ($percentage>0) { ?>
                                          <div class="offer-tag">
                                            <img src="images/offer-badge.png"><p><?=round($percentage,2)?> %<br> OFF</p>
                                          </div>
                                        <?php } ?>

                                        <div class="row align-items-center">
                                          <div class="col-md-4">
                                            <div class="cab-detail">
                                              <img src="admin/<?php echo $row2['img'] ?>">
                                              <div class="cab-name"><?php echo $row2['type']; ?></div>
                                            </div>
                                          </div>
                                          <div class="col-md-2">
                                            <div class="cab-price">
                                              <?php if($base_price>$discounted_price){ ?>
                                                <div class="base-price"><del>₹ <?=$base_price?></del> </div>
                                                <div class="save-price">Save ₹ <?=$base_price-$discounted_price?> </div>
                                              <?php } ?>
                                              <div class="price">₹ <?=$discounted_price?></div>
                                            </div>
                                          </div>
                                          <div class="col-md-4">
                                            <ul>
                                              <li><i class="fa fa-check"></i><span class="text-danger">Free Cancellation</span> till 4 hours of departure.</li>
                                              <li><i class="fa fa-check"></i>100% Verified Drivers.</li>
                                              <li class="text-success"><i class="fa fa-check"></i>Best Price Guaranteed.</li>
                                              <li><i class="fa fa-check"></i> <?=$distance;?> km Included</li>
                                              <li class="text-danger"><i class="fa fa-check"></i><?=$extra_after_km?>/Km After <?=$distance;?> Kms.</li>
                                            </ul>
                                          </div>
                                          <div class="col-md-2">
                                            <div class="select-btn">
                                              <button type="submit" class="btn-theme" name="cab_cat_id" value="<?=$row2['id']; ?>">Select</button>
                                            </div>
                                          </div>
                                        </div>
                                      </form>
                                    </div>
                                  </div>
                                  <?php $i++; } ?>
                                </div>
                              </div>
                            </section>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <!--search form-->

                <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?=$google_key?>&libraries=places"></script>
                <script>
                  function initialize() {
                    var options = {
                      types: "cities",
                      componentRestrictions: {
                        country: "ind"
                      },
                    };
                    var input = document.getElementById("autocomplete");
                    var autocomplete = new google.maps.places.Autocomplete(input, options);
                    var input = document.getElementById("autocomplete2");
                    var autocomplete102 = new google.maps.places.Autocomplete(input, options);
                    google.maps.event.addListener(autocomplete102, "place_changed", function() {
                      var one_way = autocomplete102.getPlace();

                      document.getElementById("lat").value = one_way.geometry.location.lat();
                      document.getElementById("long").value = one_way.geometry.location.lng();
                    });
                  }
                  google.maps.event.addDomListener(window, "load", initialize);


                  $(".date").on('change', function() {
                    var selectdate = $(this).val();
                    var minDate = $(this).attr('min');
                    // alert(minDate);
                    if (minDate != selectdate) {
                      $(".time2").show();
                      $(".time1").hide();
                      $("#first_opt").html('Select Pick Up Time');
                    } else {
                      $(".time1").show();
                      $(".time2").hide();
                      $("#first_opt").html('Select Pick Up Time');;
                    }
                  });


                </script>
                <?php include "include/footer.php" ?>

MMCT - 2023