File manager - Edit - /home/asiatechinc/public_html/asiatechinc-websites/panchachulihouse.com/admin/room_image.php
Back
<?php include 'core/init.php'; $id = $_POST['id']; $user_id = $_POST['user_id']; $name = sanitize($mysqli, $_POST['name']); $description = $_POST['description']; $amenities = $_POST['amenities']; $amenities1 = sanitize($mysqli, implode(":",$amenities)); if(!empty($_FILES['files']['name'][0])){ $files = $_FILES['files']; $uploaded = array(); $failed = array(); $allowed = array('jpg', 'jpeg', 'gif', 'png'); foreach($files['name'] as $position => $file_name){ $file_tmp = $files['tmp_name'][$position]; $file_size = $files['size'][$position]; $file_error = $files['error'][$position]; $file_ext = explode('.', $file_name); $file_ext = strtolower(end($file_ext)); if(in_array($file_ext,$allowed)){ if($file_error === 0){ if($file_size <= 8388608){ $file_name_new = uniqid('', true). '.' . $file_ext; $file_destination = 'images/room/'. $file_name_new; if(move_uploaded_file($file_tmp,$file_destination)){ $uploaded[$position] = $file_destination; mysqli_query($mysqli, "INSERT INTO `roomimage` (`user_id`, `room_id`, `image`, `status`) VALUES ('$user_id', '$id', '".$file_destination."', 1)"); } else{ $failed[$position] = "[{$file_name}] failed to upload"; } } else { $failed[$position] = "[{$file_name}] is too large."; } } else{ $failed[$position] = "[{$file_name}] errored with code {$file_error}."; } } else { $failed[$position] = "[{$file_name}] file extension '{$file_ext}' is allowed"; } } } mysqli_query($mysqli, "UPDATE `room` SET `name` = '$name', `description` = '$description', `amenities` = '$amenities1' WHERE `id` = '$id'"); header('Location: room?success'); ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings