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.229.92
Current File : /var/www/html/site_shopudiet/admin/add_product-26-02-2021.php
    <?php
    include 'dbconnect.php';

    $cat =$_POST['category_name'];
    $product_code=$_POST['product_code'];
    $sub_cat=implode(',', $_POST['subcategory']);
      $p_name=$_POST['product_name'];
      $price=$_POST['price'];
    $orgnon =$_POST['orgnon'];
    $purchase_total =$_POST['purchase_total'];
    $purchase_amount =$_POST['purchase_amount'];
    $purchase_gst =$_POST['purchase_gst'];
    $st =$_POST['stock'];
        $cgst = $_POST['cgst'];
        $sgst = $_POST['sgst'];
        $gst = $cgst+$sgst;
    
    if(isset($_POST['top'])) {
        $top = $_POST['top'];
    }
    else { $top = 0;  }
    if($st == '') { $stock = 20;} else { $stock = $st;}
      $discount=$_POST['discount'];
      if(empty($discount)){
        $disc_rate=0;
      }
      else{
        $disc_rate1=$price-($price*($discount/100));
      }
     
      $disc_rate=round($disc_rate1);
      
      
       $weight=$_POST['weight'];

      $desc=$_POST['description'];
      $manuf_name=$_POST['manuf'];
       
      $file_name1 = basename($_FILES["file1"]["name"]);
      $target_file =  "img/".basename($_FILES["file1"]["name"]);
      move_uploaded_file($_FILES["file1"]["tmp_name"], $target_file);




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

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

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

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

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

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

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

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

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



     $sql = "INSERT INTO product(category_name,sub_category,product_name,price,weight,description,file1,file2,file3,prdct_code,manuf_name,doc1,doc2,doc3,doc4,doc5,discount,mrp,file4,file5,org_status,stock,cgst,sgst,gst,top,purchase_amount,purchase_total,purchase_gst)
       VALUES('$cat','$sub_cat','$p_name','$price','$weight','$desc','$file_name1','$file_name2','$file_name3','$product_code','$manuf_name','$doc1','$doc2','$doc3','$doc4','$doc5','$discount','$disc_rate','$file_name4','$file_name5','$orgnon','$stock','$cgst','$sgst','$gst','$top','$purchase_amount','$purchase_total','$purchase_gst')";


       if ($conn->query($sql) === TRUE)
         {
              echo "<script> alert('Successfull'); window.location.href='product_list.php'; </script>";

        } 
      else 
         {
           echo "Error: " . $sql . "<br>" . $conn->error;
         }


    ?>