Uname : Linux V-ShopU01 4.18.0-348.20.1.el8_5.x86_64 #1 SMP Thu Mar 10 20:59:28 UTC 2022 x86_64
Server : Apache/2.4.37 (rocky) OpenSSL/1.1.1k
Whoami : apache
Safe Mode : OFF
DOCUMENT ROOT : /var/www/html/site_shopudietDisable Function :
Path : /var/www/html/site_shopudiet/admin/
Server IP : 65.20.74.164
Client IP : 3.16.137.10
Current File : /var/www/html/site_shopudiet/admin/brand_update.php |
<?php
include('dbconnect.php');
include 'lib/ImageResize.php';
use \Gumlet\ImageResize;
$home_id = $_POST['id'];
$brand=addslashes($_POST['brand_name']);
$desc=addslashes($_POST['brand_description']);
$squery = "select * from brand WHERE id='$home_id'";
$result = mysqli_query($conn, $squery);
while( $row = mysqli_fetch_array($result))
{
$brand_image=$row['brand_image'];
$image_br=$row['image'];
$image_name = basename($_FILES["image"]["name"]);
$target_file = "./img/".basename($_FILES["image"]["name"]);
move_uploaded_file($_FILES["image"]["tmp_name"], $target_file);
$image_name1 = basename($_FILES["image_br"]["name"]);
$target_file1 = "./img/".basename($_FILES["image_br"]["name"]);
move_uploaded_file($_FILES["image"]["tmp_name"], $target_file1);
if ($conn->connect_error)
{
die("connecion failed:" .$conn->connect_error);
}
if($image_name == null) {
$img1 = $brand_image;
} else {
$image = new ImageResize($target_file);
$image->scale(50);
$image->save('mobile/img/'.$image_name);
$img1 = $image_name;
}
if($image_name1 == null) {
$img2 = $image_br;
} else {
$image = new ImageResize($target_file1);
$image->scale(50);
$image->save('mobile/img/'.$image_name1);
$img2 = $image_name1;
}
mysqli_query($conn,"UPDATE `brand` SET `brand_name`='$brand',`brand_description`='$desc', `brand_image`='$img1',`image`='$img2' where id='$home_id' ");
if(mysqli_affected_rows($conn) > 0){
echo "<script> alert('update success'); window.location.href='brand_list.php'; </script>";
} else {
echo "<script> alert('update not success'); window.location.href='brand_list.php'; </script>";
echo mysqli_error ($conn);
}
}
?>