hjkhhjhjol;io;ioio;ioiio;ioreererereio;;iooi;i;o;oii;o;ioo;iio;oi;
bnmbnmbnmnbmbio;io;irererereeo;o;oi;;oi;oioi;oi;oio;;oovn
/
home
/
u174022924
/
domains
/
rockonwheelstravels.in
/
public_html
/
admin
/
Upload FileeE
HOME
<?php include 'lib/core.php'; //Show All cities if($_SERVER['REQUEST_METHOD'] == "GET") { if (isset($_GET['show_cities'])) { $show = "SELECT * FROM low_price_route"; $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'; } if ($define==1) { $href='low_price_route_oneway'; }else{ $href='low_price_route_roundway'; } if(!empty($city)) { $sql = "INSERT INTO no_return_cities(city,low_price,cab_type_id,type) VALUES('$city','$price','$type','$define')"; if ($conn->query($sql)) { echo '<script language="javascript">'; echo 'alert("Added 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_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']); $i=0; $sql = "SELECT * FROM cab_types"; $res = $conn->query($sql); $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($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>'; } $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 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']; $type = implode(',', $_POST['type']); $price = $_POST['edit-city-price']; $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'; } if ($define==1) { $href='low_price_route_oneway'; }else{ $href='low_price_route_roundway'; } $sql = "UPDATE no_return_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>'; } } if (isset($_POST['selectid'])) { $id = $_POST['selectid']; $query = "SELECT * FROM no_return_cities WHERE id = " . $id; $result = $conn->query($query); $output=''; while($value = mysqli_fetch_array($result)) { $output.='<option value="'.$value->type.'">'.$value->type.'</option>'; } echo $output; } //Delete package cities if (isset($_POST['delete_id'])) { $id = $_POST['delete_id']; $query = "DELETE FROM no_return_cities WHERE id = " . $id; if ($conn->query($query)) { echo "Success"; } else { echo "Something Wrong"; } } } ?>