|
Server IP : 2a02:4780:11:1596:0:cbc:26e7:10 / Your IP : 216.73.217.7 Web Server : LiteSpeed System : Linux in-mum-web1496.main-hosting.eu 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64 User : u213657319 ( 213657319) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u213657319/domains/mutiyanglobal.com/public_html/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
session_start();
include 'connection.php';
if($_SESSION['uid'] == ''){
header('location: login.php');
}
$checkout = '';
$product = '';
$subtotal = '';
if(isset($_GET['pid']) != '' && $_GET['quantity'] != ''){
$quantity = $_GET['quantity'];
$query = mysqli_query($con,'SELECT * FROM products WHERE id = "'.$_GET['pid'].'"');
$row = mysqli_fetch_array($query);
$product = '<div class="media mb-2 border-bottom">
<div class="media-body"> <a href="product-detail.php?id='.$row["id"].'">'.$row["name"].'</a>
<div class="small text-muted">Price: ₹'.$row["price"].' <span class="mx-2">|</span> Qty: '.$quantity.' <span class="mx-2">|</span> Subtotal: ₹'.$row['price']*$quantity.'.00</div>
</div>
</div>';
$subtotal = $quantity * $row['price'];
if(isset($_POST['place-order'])){
date_default_timezone_set("Asia/Kolkata");
$date=date("d/m/Y");
$query = mysqli_query($con,'INSERT INTO orders(`userid`, `productid`, `quantity`, `status`, `date`) VALUES("'.$_SESSION["uid"].'", "'.$_GET["pid"].'", "'.$_GET['quantity'].'",
"pending", "'.$date.'")');
if($query){
$_SESSION['last-id'] = mysqli_insert_id();
$_SESSION['amt'] = $subtotal;
header('location:payment/pay.php?checkout=automatic');
}
}
}
else{
$lastId = '';
$sql = mysqli_query($con,'SELECT * FROM cart WHERE userid ="'.$_SESSION["uid"].'" ');
if(mysqli_num_rows($sql) > 0){
while($row = mysqli_fetch_array($sql)){
$query = mysqli_query($con,'SELECT * FROM products WHERE id = "'.$row["productid"].'"');
$prod = mysqli_fetch_array($query);
$product .='<div class="media mb-2 border-bottom">
<div class="media-body"> <a href="product-detail.php?id='.$prod["id"].'">'.$prod["name"].'</a>
<div class="small text-muted">Price: ₹ '.$prod["price"].' <span class="mx-2">|</span> Qty: '.$row['quantity'].' <span class="mx-2">|</span> Subtotal: ₹'.$prod['price']*$row['quantity'].'.00</div>
</div>
</div>';
$subtotal += $row['quantity'] * $prod["price"];
}
}
if(isset($_POST['place-order'])){
$pid = '';
$quantity = '';
date_default_timezone_set("Asia/Kolkata");
$date=date("d/m/Y");
$query = mysqli_query($con,'SELECT * FROM cart WHERE userid ="'.$_SESSION["uid"].'"');
while($row = mysqli_fetch_array($query)){
$pid .= $row['productid'].', ';
$quantity .= $row['quantity'].', ';
}
$quan = substr($quantity, 0, -2);
$pids = substr($pid, 0, -2);
$sql = mysqli_query($con,'INSERT INTO orders(`userid`, `productid`, `quantity`, `status`, `date`) VALUES("'.$_SESSION['uid'].'", "'.$pids.'", "'.$quan.'", "pending", "'.$date.'")');
$lastId = mysqli_insert_id();
$emptycart = mysqli_query($con,'DELETE FROM cart WHERE userid="'.$_SESSION['uid'].'"');
$_SESSION['last-id'] = $lastId;
$_SESSION['amt'] = $subtotal;
$_SESSION['cu-id'] = $_SESSION['uid'];
header('location:payment/pay.php?checkout=automatic');
}
}
if(isset($_POST['add-address'])){
$address = $_POST['address'];
$landmark = $_POST['landmark'];
$state = $_POST['state'];
$country = $_POST['country'];
$zip = $_POST['zip'];
$type = $_POST['address-type'];
$query = mysqli_query($con,'INSERT INTO address(`userid`, `address`, `landmark`, `state`, `country`, `pin`, `type`) VALUES("'.$_SESSION["uid"].'","'.$address.'", "'.$landmark.'"
, "'.$state.'", "'.$country.'", "'.$zip.'", "'.$type.'")');
if($query){
header('Location: '.$_SERVER['REQUEST_URI']);
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<!-- Basic -->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Site Metas -->
<title>Mutiyan Global | Checkout</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="">
<!-- Site Icons -->
<link rel="shortcut icon" href="favicon/favicon-32x32.png" type="image/x-icon">
<link rel="apple-touch-icon" href="favicon/apple-touch-icon.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Site CSS -->
<link rel="stylesheet" href="css/style.css">
<!-- Responsive CSS -->
<link rel="stylesheet" href="css/responsive.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/custom.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Start Main Top -->
<?php include 'header.php'; ?>
<!-- End Main Top -->
<!-- Start Top Search -->
<div class="top-search">
<div class="container">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-addon close-search"><i class="fa fa-times"></i></span>
</div>
</div>
</div>
<!-- End Top Search -->
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Checkout</h2>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<!-- Start Cart -->
<div class="cart-box-main">
<div class="container">
<div class="row">
<div class="col-sm-6 col-lg-6 mb-3">
<div class="checkout-address">
<div class="title-left">
<h3>Billing address</h3>
</div>
<?php
$add = mysqli_query($con,'SELECT * FROM address WHERE userid = "'.$_SESSION["uid"].'"');
$address = mysqli_fetch_array($add);
?>
<form class="needs-validation" method="post" action="">
<div class="mb-3">
<label for="address">Address *</label>
<textarea class="form-control" name="address" <?php if($address['address'] != ''){ echo 'disabled'; } ?> rows="4" required><?php if($address['address'] != ''){ echo $address['address']; } ?></textarea>
</div>
<div class="mb-3">
<label for="username">Landmark *</label>
<div class="input-group">
<input type="text" class="form-control" name="landmark" <?php if($address['landmark'] != ''){ echo 'disabled'; } ?> value="<?php if($address['landmark'] != ''){ echo $address['landmark']; }?>" required>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label for="state">State *</label>
<div class="input-group">
<input type="text" class="form-control" name="state" <?php if($address['state'] != ''){ echo 'disabled'; } ?> value="<?php if($address['state'] != ''){ echo $address['state']; }?>" required>
</div>
</div>
<div class="col-md-5 mb-3">
<label for="country">Country *</label>
<div class="input-group">
<input type="text" class="form-control" name="landmark" <?php if($address['country'] != ''){ echo 'disabled'; } ?> value="<?php if($address['country'] != ''){ echo $address['country']; }?>" required>
</div>
</div>
<div class="col-md-3 mb-3">
<label for="zip">Zip/Pin Code *</label>
<input type="text" class="form-control" name="zip" <?php if($address['pin'] != ''){ echo 'disabled'; } ?> value="<?php if($address['pin'] != ''){ echo $address['pin']; }?>" required>
</div>
</div>
<div class="custom-control custom-checkbox">
<input type="radio" name="address-type" value="Home" class="custom-control-input" id="save-info" <?php if($address['type'] == 'Home'){ echo 'checked'; } ?>>
<label class="custom-control-label" for="save-info">Home Address</label>
</div>
<div class="custom-control custom-checkbox">
<input type="radio" name="address-type" value="Office" class="custom-control-input" id="same-address" <?php if($address['Office'] == 'Home'){ echo 'checked'; } ?>>
<label class="custom-control-label" for="same-address">Office Address</label>
</div>
<hr class="mb-4">
<button type="submit" name="add-address" <?php if($address != ''){ echo 'disabled'; } ?> class="ml-auto btn hvr-hover place-order">Add Address</button>
</form>
</div>
</div>
<div class="col-sm-6 col-lg-6 mb-3">
<div class="row">
<div class="col-md-12 col-lg-12">
<div class="odr-box">
<div class="title-left">
<h3>Shopping cart</h3>
</div>
<div class="rounded p-2 bg-light">
<?php echo $product; ?>
</div>
</div>
<div class="order-box mt-2">
<div class="d-flex">
<div class="font-weight-bold">Product</div>
<div class="ml-auto font-weight-bold">Total</div>
</div>
<hr class="my-1">
<div class="d-flex">
<h4>Sub Total</h4>
<div class="ml-auto font-weight-bold"> ₹ <?php echo $subtotal; ?> </div>
</div>
<div class="d-flex">
<h4>Shipping Cost</h4>
<div class="ml-auto font-weight-bold"> Free </div>
</div>
<hr>
<div class="d-flex gr-total">
<h5>Grand Total</h5>
<div class="ml-auto h5"> ₹ <?php echo $subtotal; ?> </div>
</div>
<hr>
</div>
</div>
<div class="col-12 d-flex shopping-box">
<form method="post" action="">
<button type="submit" name="place-order" class="ml-auto btn hvr-hover place-order">Place Order</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Cart -->
<!-- Start Instagram Feed -->
<!-- End Instagram Feed -->
<!-- Start Footer -->
<?php include 'footer.php'; ?>
<!-- ALL JS FILES -->
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- ALL PLUGINS -->
<script src="js/jquery.superslides.min.js"></script>
<script src="js/bootstrap-select.js"></script>
<script src="js/inewsticker.js"></script>
<script src="js/bootsnav.js."></script>
<script src="js/images-loded.min.js"></script>
<script src="js/isotope.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/baguetteBox.min.js"></script>
<script src="js/form-validator.min.js"></script>
<script src="js/custom.js"></script>
</body>
</html>