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_shopudiet
Disable Function :
Path : /var/www/html/site_shopudiet/admin/

Server IP : 65.20.74.164 Client IP : 18.117.75.235
Current File : /var/www/html/site_shopudiet/admin/super_update.php
	
<?php
include('dbconnect.php');

$home_id = $_POST['id'];
$super=addslashes($_POST['sup_cat_name']);
$category=$_POST['categories'];
$cat = implode(',',$category);
$squery = "select * from super_category WHERE id='$home_id'";
        $result = mysqli_query($conn, $squery);
        while( $row = mysqli_fetch_array($result))
        {

           $brand_image=$row['image'];
           $cat = $row['category_id'];

$image_name = basename($_FILES["image_br"]["name"]);
$target_file =  "./img/".basename($_FILES["image_br"]["name"]);
  move_uploaded_file($_FILES["image_br"]["tmp_name"], $target_file);
  

  if ($conn->connect_error)
   {
    die("connecion failed:" .$conn->connect_error);
  }
if($image_name == null) {
    $img1 = $brand_image;
} else {
    $img1=$image_name;
}
$cats = explode(',',$cat);
$item_num=array_merge($cats,$category);
$res = array_unique($item_num);
$c = implode(',',$res);
mysqli_query($conn,"UPDATE `super_category` SET `name`='$super',`category_id`='$c', `image`='$img1' where id='$home_id' ");

if(mysqli_affected_rows($conn) > 0){
    $sup_id = $home_id;
    
    	for($i = 0; $i<count($category); $i++)
    	{
    	    $sqls = mysqli_query($conn,"INSERT INTO super_vs_category(super_id,category_id)
            	VALUES('$sup_id','$category[$i]')");
    	}
   
    echo "<script> alert('update success'); window.location.href='super_category_list.php'; </script>";
  } else {
     echo "<script> alert('update not success'); window.location.href='super_category_list.php'; </script>";
    echo mysqli_error ($conn);
  } 


}
?>