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/
Server IP : 65.20.74.164
Client IP : 18.222.114.25
Current File : /var/www/html/site_shopudiet/add_multicart.php |
<?php
include 'dbconnect.php';
session_start();
unset($_SESSION['grand_total1']);
unset($_SESSION['coupon']);
unset($_SESSION['discount_rate']);
if(!isset($_SESSION['id'])){
header('Location: login.php');
}
// logout
if(isset($_POST['but_logout'])){
session_destroy();
header('Location: login.php');
}
$id=$_GET['id'];
$sql="select * from product where id='".$id."' ";
$result=mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result)){
$prduct_id=$row['id'];
$user_id=$_SESSION['id'];
$stock=$row['stock'];
$prdctname=$row['product_name'];
$price=$row['price'];
$quantity=$row['weight'];
$product_description=$row['description'];
$feature_image=$row['file1'];
$status='enquery';
$gst = $row['gst'];
$cgst = $row['cgst'];
$sgst = $row['sgst'];
$no=$_POST['qty'];
if($stock < $no) { $no_item=$stock; } else { $no_item=$_POST['qty']; }
$user_name=$_SESSION['name'];
$user_email=$_SESSION['email'];
$user_phone=$_SESSION['phone'];
$date = date('Y-m-d H:i:s');
}
$sql="insert into product_cart(prdctname,price,prduct_id,user_id,user_name,email,phone,product_description,quantity,no_of_item,feature_image,status,date,stock,gst,cgst,sgst) values('$prdctname','$price','$prduct_id','$user_id','$user_name','$user_email','$user_phone','$product_description','$quantity','$no_item','$feature_image','$status','$date','$stock','$gst','$cgst','$sgst')";
if(mysqli_query($conn,$sql)){
// echo '<script type="text/javascript">alert("Added to cart");window.location.assign("home.php");</script>';
header('location:home.php');
}
else{
echo"not inserted".mysqli_error();
}
mysqli_close($conn);
?>