[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: cart.php
<?php include("header.php"); ?> <div class="check-out"> <div class="container"> <h2>Check out</h2> <form method="post" enctype="multipart/form-data"> <div class="checkout-left-box"> <?php $count_add=1; if(isset($_SESSION["cart_item"])){ $item_total = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ //print_r($item); ?> <script> $(document).ready(function(){ $("#qty<?php echo $count_add; ?>").change(function(){ var qty =$("#qty<?php echo $count_add; ?>").val(); var code =$("#code<?php echo $count_add; ?>").val(); var price =$("#price<?php echo $count_add; ?>").val(); var ori_price =$("#ori_price<?php echo $count_add; ?>").val(); var gprice = qty*price; var total_ori = qty*ori_price; var valueinshow=price+"*"+qty+"="+gprice; var total_dis = total_ori-gprice; $.ajax({ type: "POST", url: "cart_update.php", data: "qty="+qty+"&code="+code+"&price="+price, cache: false, success: function(result){ a=result; $("#gprice<?php echo $count_add; ?>").val(gprice); $("#sub_tot").val(gprice); $("#quantity<?php echo $count_add; ?>").val(qty); $("#base_total").val(gprice); $("#show_price").html("₹"+gprice); $("#main_total").html("₹"+total_ori); $("#dis").html("-₹"+total_dis); calculateSum(); } }); }); }); </script> <div class="checkout-box-block"> <div class="checkout-image-content"> <a href="single-product.php"> <img src="<?=$pic_img?>/<?=$item["img"]; ?>" alt=""> </a> </div> <div class="checkout-dec-content"> <h4><?=$item["pro_name"]; ?></h4> <input type="hidden" name="product_name[]" value="<?=$item["pro_name"]; ?>" readonly /> <input type="hidden" name="price[]" id="price<?php echo $count_add; ?>" value="<?=$item["price"]; ?>" readonly /> <input type="hidden" name="code[]" id="code<?php echo $count_add; ?>" value="<?php echo $item["code"]; ?>" readonly /> <input type="hidden" name="totalp[]" class="gprice" id="gprice<?php echo $count_add; ?>" value="<?php echo $item["price"]; ?>" readonly /> <input type="hidden" name="ori_price[]" class="ori_price" id="ori_price<?php echo $count_add; ?>" value="<?php echo $item["ori_price"]; ?>" readonly /> <h5>₹<?=$item["price"]; ?></h5> <div class="quantity"> <label>Quantity: </label> <select id="qty<?php echo $count_add; ?>" name="qty[]" > <?php for($i=1;$i<=10;$i++){ ?> <option value="<?php echo $i; ?>" <?php if($i==$qty) echo 'selected'; ?>><?php echo $i; ?></option> <?php }?> </select> </div> <div class="close"> <a href="cart.php?action=remove&code=<?php echo $item["code"]; ?>&size=<?php echo $item["size"]; ?>" class="button" ><i class="fa fa-times" aria-hidden="true"></i></a> </div> </div> </div> <?php $item_total += ($item["price"]*$item["quantity"]); ++$count_add; } echo"<input type='hidden' value='$item_total' id='tot' name='tot'>"; $dis +=($item["ori_price"]-$item["price"]); $original_total +=($item["ori_price"]*$item["quantity"]); } ?> </div> <div class="checkout-right-box"> <div class="total-checkout"> <p>Subtotal <span id="main_total">₹<?=$original_total?></span></p> <p>You Saved<span class="price-values" id="dis">- ₹<?=$dis?></span></p> <p>Shipping (Standard)<span class="free">Free</span></p> <div class="price-breakup-final"> <p>Total Cost <span id='show_price'>₹<?=$item_total?></span> <input type="hidden" name="sub_tot" id="sub_tot" value="<?=$item_total?>" readonly=""> </p> </div> </div> <div class="submit-chekout"> <input type="submit" value="CHECKOUT" name="sub" class="button"> </div> </div> </form> </div> </div> <?php if(isset($_POST['sub'])){ // echo "aaa"; if(isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) { $stmt111=$show->readwithdata('user','user_id',$_SESSION['user_id']); while($row11=$stmt111->fetch(PDO::FETCH_ASSOC)){ $uaddress=$row11['address']; } $oid=$show->getid('ids','ORD'); $item_name=$_POST['product_name']; $item_code=$_POST['code']; $item_qty=$_POST['qty']; $item_price=$_POST['price']; $totalp=$_POST['totalp']; for($i = 0; $i < count($item_name); $i++){ $price =$item_price[$i]; //$total_p=intval($price*$item_qty[$i]); // $gst_value=($gst[$i]/100)*$total_p; $data=array( 'order_id'=>$oid, 'product_id'=>$item_code[$i], 'product_name'=>$item_name[$i], 'quantity'=>$item_qty[$i], 'price'=>$item_price[$i], 'order_time'=>date('Y-m-d h:i:s'), 'user_id'=>$_SESSION['user_id'], 'total'=>$totalp[$i], ); // print_r($data); echo "<br>"; $r=$show->insert('bill',$data); } $data2=array( 'order_id'=>$oid, 'amount'=>$_POST['sub_tot'], 'user_id'=>$_SESSION['user_id'], 'client_name'=>$_SESSION['user'], 'email'=>$_SESSION['username'], 'phon'=>$_SESSION['user_phone'], 'pay_status'=>'Pending', 'status'=>'Pending' ); echo "<br>"; $r1=$show->insert('place_order',$data2); if($r1 && $r){ $_SESSION['total']=$tot; if($uaddress==''){ echo "<script>window.location.href='place_order_new.php?order=".$oid."&no_of_p=".urlencode($item_qty[$i])."'</script>"; }else{ echo "<script>window.location.href='place_order.php?order=".$oid."&no_of_p=".urlencode($item_qty[$i])."'</script>"; } } }else { $url="cart.php"; echo '<script> setTimeout(function() { swal({ title: "Oops!", text: "Please Login/Sign up to continue", type: "error" }, function() { swal("You will be redirected to Login page"); window.location = "log-in.php?pg='.base64_encode($url).'"; }); }, 1000); </script>'; } } ?> <?php include("footer.php"); ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 677.54 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619