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.188.96.232
Current File : /var/www/html/site_shopudiet/admin/packages_update-20-03-2021-p.php
	
<?php
include('dbconnect.php');
$home_id = $_GET['id'];
$category_name = $_POST['category_name'];
$product_name = $_POST['product_name'];
$price = $_POST['price'];
$priceorg = $_POST['priceorg'];
$description = $_POST['description'];

$items = implode(',', $_POST['items']);
$s_weight = implode(',', $_POST['s_weight']);


$squery = "select * from packages WHERE id='$home_id'";
        $result = mysqli_query($conn, $squery);
        while( $row = mysqli_fetch_array($result))
        {




           $imag=$row['image'];





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


  if ($conn->connect_error)
   {
    die("connecion failed:" .$conn->connect_error);
  }
$a = null;




if ($image_name==$a) 
{
  mysqli_query($conn,"  UPDATE `packages` SET `category_name`='$category_name', `product_name`='$product_name', `price`='$price', `description`='$description', `items`='$items',`s_weight`='$s_weight',`image`='$imag',`priceorg`='$priceorg' where id='$home_id' ");

  if(mysqli_affected_rows($conn) > 0){
    echo "<script> alert('update success'); window.location.href='package_view.php'; </script>";
  } else {
     echo "<script> alert('update not success'); window.location.href='package_view.php'; </script>";
    echo mysqli_error ($conn);
  } 
}

else
 {
 mysqli_query($conn,"  UPDATE `packages` SET `category_name`='$category_name', `product_name`='$product_name', `price`='$price', `description`='$description', `items`='$items',`s_weight`='$s_weight',`image`='$image_name',`priceorg`='$priceorg' where id='$home_id' ");

  if(mysqli_affected_rows($conn) > 0){
    echo "<script> alert('update success'); window.location.href='package_view.php'; </script>";
  } else {
     echo "<script> alert('update not success'); window.location.href='package_view.php'; </script>";
    echo mysqli_error ($conn);
  } 
}






}
?>