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 : 3.145.180.81
Current File : /var/www/html/site_shopudiet/admin/add_super_category.php
<?php
include 'dbconnect.php';

	$super=addslashes($_POST['sup_cat_name']);
	$category=$_POST['categories'];
	$cat = implode(',',$category);
    $image_name = basename($_FILES["image_br"]["name"]);
    $target_file =  "./super_category/".basename($_FILES["image_br"]["name"]);
	move_uploaded_file($_FILES["image_br"]["tmp_name"], $target_file);
	$sql = "INSERT INTO super_category(name,category_id,image)
	VALUES('$super','$cat','$image_name')";

	if ($conn->query($sql) === TRUE)
	{
	    $sup_id = mysqli_insert_id($conn);
    	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]')");
    	}
        header("Location:super_category_list.php");
	} 
		else 
		{
			echo "Error: " . $sql . "<br>" . $conn->error;
		}



?>