[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: cart.php
<?php include('header.php'); ?> <!-- Inner-Banner --> <div class="inner-banner"> <img src="images/banner2.jpg" alt="" class="inner-banner-img"> <div class="container"> <ul> <li><a href="cart.php" class="active">Cart</a></li> | <li><a href="index.php" class="">Home</a></li> </ul> </div> </div> <!-- // Inner-Banner --> <div class="cart-flipkart"> <div class="container"> <!-- tittle heading --> <div class="inner-title"> <h2>Welcome to Cart</h2> </div> <!-- //tittle heading --> <div class="flipkart-box"> <div class="row"> <form action="" onsubmit="" method="post"> <div class="col-md-8 col-sm-8 col-xs-12"> <div class="flipkart-box-left"> <div class="title-top"> <h3>My Cart</h3> </div> <?php $count_add=1; if(isset($_SESSION["cart_item"])){ $item_total = 0;$original_total=0;$item_original_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();//alert(qty); var code =$("#code<?php echo $count_add; ?>").val(); var price =$("#price<?php echo $count_add; ?>").val(); var ori_price =$("#oprice<?php echo $count_add; ?>").val(); var gprice = qty*price; var total_ori = qty*price; var original=qty*ori_price;// alert(original); var total_dis = original-gprice; var total=gprice+parseInt(48); var valueinshow="₹ "+price+"*"+qty+"=₹ "+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); $("#ori_price<?php echo $count_add; ?>").val(original); $("#sub_tot").val(total); $("#quantity<?php echo $count_add; ?>").val(qty); $("#show_price").html("₹"+total); $("#main_total").html("₹"+total_ori); $("#original_total").html("₹"+original); //$("#t_discount").html("-₹"+total_dis); $("#valueinshow<?php echo $count_add; ?>").html(valueinshow); calculateSum(); } }); }); }); function calculateSum(){ var sum = 0; var orig_price = 0; var amt=parseInt(40); //alert(amt); var discount=parseInt($('#discount').val()); $(".gprice").each(function(){ // var t=$('.gprice').val(); sum += parseFloat($(this).val()); }); $(".ori_price").each(function(){ // var t=$('.gprice').val(); orig_price += parseFloat($(this).val()); }); //alert(sum_gst); $("#main_total").html("₹"+sum); $("#tot").val(sum); var dis=orig_price-sum; var grand_total=(sum+parseInt(48)); //alert(grand_total); $('#gtotal').val(grand_total); $("#original_total").html("₹"+orig_price); $('#total_delivery').html("₹"+grand_total); $('#t_discount').html("-₹"+dis); } </script> </script> <div class="det-bottom"> <div class="col-md-8 col-sm-8 col-xs-12" style="padding:0;"> <div class="det-bottom-box"> <img src="<?=$pic_img?>/<?=$item["img"]; ?>" alt=""> </div> <div class="det-bottom-text"> <h4><?=$item["pro_name"]; ?></h4> <input type="hidden" name="product_name[]" value="<?=$item["pro_name"]; ?>" readonly /> <input type="hidden" name="price[]" id="price<?=$count_add;?>" value="<?=$item["price"]; ?>" readonly /> <input type="hidden" name="oprice[]" id="oprice<?=$count_add;?>" value="<?=$item["ori_price"]; ?>" readonly /> <input type="hidden" name="code[]" id="code<?=$count_add;?>" value="<?php echo $item["code"]; ?>" readonly /> <input type="hidden" name="size[]" id="size<?=$count_add;?>" value="<?php echo $item["size"]; ?>" 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>Size: <b><?=$item["size"]; ?></b></h5> <h6 id="price_h6<?php echo $count_add; ?>">₹<?=intval($item["price"])?> <span>₹<?=intval($item["ori_price"])?></span></h6> <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==$item["quantity"]) echo 'selected'; ?>><?php echo $i; ?></option> <?php }?> </select> </div> <a href="cart.php?action=remove&code=<?php echo $item["code"]; ?>&size=<?php echo $item["size"]; ?>" class="button" style="padding: 0; background: none;"> REMOVE </a> </div> </div> </div> <?php $item_total += ($item["price"]*$item["quantity"]); $item_original_total +=($item["ori_price"]*$item["quantity"]); ++$count_add; } echo"<input type='hidden' value='$item_total' id='tot' name='tot'>"; $dis +=($item["price"]-$item["price"]); $original_total +=($item["price"]*$item["quantity"]); } ?> <div class="snipcart-details top_brand_home_details"> <input type="submit" value="CHECKOUT" name="sub" class="button" style=" "> </div> </div> </div> </form> <div class="col-md-4 col-sm-4 col-xs-12"> <div class="flipkart-box-right"> <h3>Price Details </h3> <p>Price (<?=$count_add-1?> items)<span id="original_total"> ₹<?=$item_original_total?></span></p> <p>Discount <span id="t_discount" style="color: #ff0000;" >− ₹<?=$item_original_total-$item_total?></span></p> <p>Total Cost <span id='main_total'>₹<?=$item_total?></span> <p>Delivery Charges <span>₹48</span></p> <h2>Total Amount <span id='total_delivery'>₹<?=$item_total+48?></span></h2> </div> </div> </div> </div> <div class="clearfix"></div> </div> </div> <?php if(isset($_POST['sub'])){ if(isset($_SESSION['login_id']) && !empty($_SESSION['login_id'])) { $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']; $size=$_POST['size']; 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], 'size'=>$size[$i], 'order_time'=>date('Y-m-d h:i:s'), 'user_id'=>$_SESSION['login_id'], 'total'=>$totalp[$i], ); print_r($data); echo "<br>"; $r=$show->insert('bill',$data); } $tot=intval($_POST['tot']+48); $data2=array( 'order_id'=>$oid, 'amount'=>$_POST['tot'], 'status'=>'Pending', 'user_id'=>$_SESSION['login_id'], 'client_name'=>$_SESSION['login_user'], 'email'=>$_SESSION['username'], 'gst'=>$_POST['gst'], 'delivery_charge'=>48, 'delivery_type'=>$_POST['del_type'], 'total'=>$tot, 'promo_code'=>$_POST['promo'], 'promo_code_val'=>$_POST['promo_discount'] ); print_r($data2); echo "<br>"; echo "<br>"; $r1=$show->insert('place_order',$data2); if($r1 && $r){ $_SESSION['total']=$tot; echo "<script>window.location.href='place_order.php?order=".$oid."&sub_t=&no_of_p=".urlencode($item_qty[$i])."'</script>"; } } else { $url=$_SERVER['REQUEST_URI']; 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 = "login.php?pg='.base64_encode($url).'"; }); }, 1000); </script>'; } } ?> <!-- //top-brands --> <?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.62 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