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 : 3.145.125.169
Current File : /var/www/html/site_shopudiet/admin/packages-20-03-2021-p.php |
<?php
include 'dbconnect.php';
$category_name = $_POST['category_name'];
$product_name = $_POST['product_name'];
$price = $_POST['price'];
$priceorg = $_POST['priceorg'];
$description = $_POST['description'];
$items = implode(',', $_POST['items']);
// $count=count($items);
// $s_weight = implode(',', $s_weight);
$image_name = basename($_FILES["image"]["name"]);
$target_file = "./img/".basename($_FILES["image"]["name"]);
move_uploaded_file($_FILES["image"]["tmp_name"], $target_file);
mysqli_query($conn," INSERT INTO `packages`(`category_name`, `product_name`, `price`, `description`, `items`,`image`,`priceorg`) VALUES ('$category_name','$product_name','$price','$description','$items','$image_name','$priceorg') ");
if(mysqli_affected_rows($conn) > 0){
$last_id = mysqli_insert_id($conn);
// echo $last_id;
$sam=explode(",",$items);
$count=count($sam);
$tgst = 0;
for($i=0;$i<count($sam);$i++){
$item1= $sam[$i];
// echo $item1;
$sql1="select * from product where product_name='".$item1."'";
$result = mysqli_query($conn,$sql1);
$row = mysqli_fetch_array($result);
$tax = $tax + $row['gst'];
$s_weight[]= $row['weight'];
$s_prdctid[]= $row['id'];
$s_prdctprice[]= $row['price'];
$taxRates=$row['gst'];
$taxs=$row['price']*$taxRates/100;
$tgst = $tgst+$taxs;
}
// for($i=0;$i<count($s_weight);$i++){
// echo $s_weight[$i];
// }
$s_weight = implode(',', $s_weight);
$s_prdctid = implode(',', $s_prdctid);
$s_prdctprice = implode(',', $s_prdctprice);
// echo $s_weight;
mysqli_query($conn," UPDATE packages SET s_weight = '".$s_weight."',prdct_id= '". $s_prdctid."',prdct_price= '". $s_prdctprice."',num = '".$count."',gst_price = '".$tgst."' WHERE id =".$last_id."");
echo "<script> alert('Successfull'); window.location.href='package_view.php'; </script>";
} else {
echo mysqli_error ($conn);
}
?>