Server : LiteSpeed System : Linux server551.iseencloud.net 5.14.0-570.33.2.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 14 07:37:35 EDT 2025 x86_64 User : pbkvidya ( 2092) PHP Version : 8.1.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open Directory : /home2/pbkvidya/public_html/pbkv.in/admin/ |
<?php
//update.php
include('connect.php');
if (isset($_POST['image_id'])) {
$image_id = $_POST['image_id'];
if (!empty($_FILES['file_name']['name'])) {
$fileTmp = $_FILES['file_name']['tmp_name'];
$allowImg = array('png','jpeg','jpg','gif');
$fileExnt = explode('.', $_FILES['file_name']['name']);
$fileActExt = strtolower(end($fileExnt));
$newFile = rand(). '.'. $fileActExt;
$destination = 'uploads/hotels/'.$newFile;
if (in_array($fileActExt, $allowImg)) {
if ($_FILES['file_name']['size'] > 0 && $_FILES['file_name']['error']==0) {
$query = "SELECT * FROM tbl_hotelimages WHERE himg_id = '$image_id'";
$result = mysqli_query($con, $query);
$row = mysqli_fetch_assoc($result);
$filePath = 'uploads/hotels/'.$row['hotel_img'];
if (move_uploaded_file($fileTmp, $destination)) {
$update = "UPDATE tbl_hotelimages SET hotel_img = '$newFile' WHERE himg_id = '$image_id'";
mysqli_query($con, $update);
unlink($filePath);
}
}
}
}
}
//placesimages update
if (isset($_POST['image_id1'])) {
$image_id = $_POST['image_id1'];
if (!empty($_FILES['file_name']['name'])) {
$fileTmp = $_FILES['file_name']['tmp_name'];
$allowImg = array('png','jpeg','jpg','gif');
$fileExnt = explode('.', $_FILES['file_name']['name']);
$fileActExt = strtolower(end($fileExnt));
$newFile = rand(). '.'. $fileActExt;
$destination = 'uploads/places/'.$newFile;
if (in_array($fileActExt, $allowImg)) {
if ($_FILES['file_name']['size'] > 0 && $_FILES['file_name']['error']==0) {
$query = "SELECT * FROM tbl_placesimages WHERE img_id = '$image_id'";
$result = mysqli_query($con, $query);
$row = mysqli_fetch_assoc($result);
$filePath = 'uploads/places/'.$row['file_name'];
if (move_uploaded_file($fileTmp, $destination)) {
$update = "UPDATE tbl_placesimages SET file_name = '$newFile' WHERE img_id = '$image_id'";
mysqli_query($con, $update);
unlink($filePath);
}
}
}
}
}
?>