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 : 18.217.186.244
Current File : /var/www/html/site_shopudiet/admin/add_category-20-03-2021-p.php |
<?php
include 'dbconnect.php';
$cat=$_POST['category_name'];
$desc=$_POST['category_description'];
$num=$_POST['category_num'];
$sub = array_filter($_POST['sub_cat']);
$sub_cat=implode(',', $sub);
$image_name = basename($_FILES["image"]["name"]);
$target_file = "./img/".basename($_FILES["image"]["name"]);
move_uploaded_file($_FILES["image"]["tmp_name"], $target_file);
$sql = "INSERT INTO category(category_name,image,description,num,sub_category)
VALUES('$cat','$image_name','$desc','$num','$sub_cat')";
if ($conn->query($sql) === TRUE)
{
header("Location:category_list.php");
}
else
{
echo "Error: " . $sql . "<br>" . $conn->error;
}
?>