File manager - Edit - /home/custbahd/public_html/webs/monitor/clients/pilaucity/cart/index.php
Back
<?php session_start(); require_once("../db/dbcontroller.php"); $db_handle = new DBController(); if(!empty($_GET["action"])) { switch($_GET["action"]) { case "add": if(!empty($_POST["quantity"])) { $productByCode = $db_handle->runQuery("SELECT * FROM shop WHERE code='" . $_GET["code"] . "'"); $itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'quantity'=>$_POST["quantity"], 'price'=>$productByCode[0]["price"], 'image'=>$productByCode[0]["image"])); if(!empty($_SESSION["cart_item"])) { if(in_array($productByCode[0]["code"],array_keys($_SESSION["cart_item"]))) { foreach($_SESSION["cart_item"] as $k => $v) { if($productByCode[0]["code"] == $k) { if(empty($_SESSION["cart_item"][$k]["quantity"])) { $_SESSION["cart_item"][$k]["quantity"] = 0; } $_SESSION["cart_item"][$k]["quantity"] += $_POST["quantity"]; } } } else { $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"],$itemArray); } } else { $_SESSION["cart_item"] = $itemArray; } } break; case "remove": if(!empty($_SESSION["cart_item"])) { foreach($_SESSION["cart_item"] as $k => $v) { if($_GET["code"] == $k) unset($_SESSION["cart_item"][$k]); if(empty($_SESSION["cart_item"])) unset($_SESSION["cart_item"]); } } break; case "empty": unset($_SESSION["cart_item"]); break; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="description" content=""> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags --> <!-- Title --> <title>Pilau City Cart</title> <!-- Favicon --> <link rel="icon" href="../img/logo.png"> <!-- Core Style CSS --> <link rel="stylesheet" href="../css/core-style.css"> <!-- Responsive CSS --> <link href="../css/responsive.css" rel="stylesheet"> <!--Animations--> <link rel="stylesheet" type="text/css" href="../css/Attention/blink.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/bounce.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/flicker.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/jello.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/pulsate.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/shake.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/vibrate.css"> <link rel="stylesheet" type="text/css" href="../css/Attention/wobble.css"> <link rel="stylesheet" type="text/css" href="../css/Background/background.css"> <link rel="stylesheet" type="text/css" href="../css/Bounce/bounce.css"> <link rel="stylesheet" type="text/css" href="../css/Text/blur-out.css"> <link rel="stylesheet" type="text/css" href="../css/Text/flicker-glow.css"> <link rel="stylesheet" type="text/css" href="../css/Text/focus-in.css"> <link rel="stylesheet" type="text/css" href="../css/Text/tracking-in.css"> <link rel="stylesheet" type="text/css" href="../css/Text/tracking-out.css"> <style type="text/css"> /*Logo*/ .top_logo { position: absolute; left: 0; width: 20%; } .menu_logo img{ width: 30%; z-index: 1200; } /* ------------------- :: 12.0 Offer Area CSS ------------------- */ .offer_area { position: relative; z-index: 1; } .offer-content-area { background-color: rgba(58, 58, 58, 0.7); padding: 100px 50px 50px; position: relative; z-index: 1; } .offer-content-area h2 { position: relative; z-index: 1; color: #fff; font-size: 48px; text-transform: uppercase; margin-bottom: 0; } .karl-level { position: absolute; z-index: 2; color: #fff; font-size: 11px; text-transform: uppercase; font-weight: 700; background-color: purple; padding: 3px 10px; top: -30px; left: 10px; } .karl-level:after { position: absolute; z-index: 2; content: ""; width: 0; height: 0; border-style: solid; border-width: 0 9px 9px 9px; border-color: transparent transparent purple transparent; bottom: -2px; left: -6px; -webkit-transform: rotate(-45deg); transform: rotate(-45deg); } .offer-content-area p { color: #fff; font-weight: 600; font-size: 14px; } .offer-product-price h3 { color: purple; } .offer-product-price h3 span { margin-right: 15px; font-weight: 400; text-decoration: line-through; color: #fff; } .navbar-toggler { font-weight: bold; color: white; text-align: center; width: 100%; margin-bottom: 10px; border-radius: 20px; outline: none; background-image: url(../images/rice5.jpg); background-size: cover; background-position: center; background-repeat: no-repeat; } /*Quantity*/ .product-description .quantity { display: inline-block; float: left; position: relative; z-index: 1; } .product-description .quantity .qty-text { border: 1px solid purple; border-top-left-radius: 10px; border-bottom-left-radius: 10px; height: 40px; padding: 5px 15px; width: 100px; -moz-appearance: textfield; -webkit-appearance: textfield; appearance: textfield; font-size: 14px; outline: none; } .product-description .quantity .qty-minus, .product-description .quantity .qty-plus { background-color: #fff; border: 1px solid #ddd; display: block; height: 20px; position: absolute; right: 0; text-align: center; top: 0; width: 30px; z-index: 99; cursor: pointer; font-size: 10px; line-height: 20px; color: #888; } .product-description .quantity .qty-plus { top: auto; bottom: 0; } .add-to-cart { background-color: purple; border: medium none; color: #fff; font-size: 14px; height: 40px; margin-left: 15px; text-transform: uppercase; width: 150px; cursor: pointer; border-radius: 0; border-top-right-radius: 10px; border-bottom-right-radius: 10px; } </style> </head> <body> <div class="catagories-side-menu"> <!-- Close Icon --> <div id="sideMenuClose"> <i class="ti-close"></i> </div> <!-- Side Nav --> <div class="nav-side-menu"> <div class="menu-list"> <h6>Categories</h6> <!-- ****** New Arrivals Area Start ****** --> <section class="new_arrivals_area section_padding_100_0 clearfix"> <div class="container"> <div class="row"> <div class="col-12"> <div class="section_heading text-center"> <h2>Our Menu</h2> </div> </div> </div> </div> <div class="karl-projects-menu mb-100"> <div class="text-center portfolio-menu"> <button class="btn active" data-filter="*">ALL</button> <button class="btn" data-filter=".<?php echo $product_array[$key]["name"]; ?>">Chicken</button> <button class="btn" data-filter=".<?php echo $product_array[$key]["code"]; ?>">Beef</button> <button class="btn" data-filter=".<?php echo $name?>">Goat Meat</button> <button class="btn" data-filter=".shoes">Vegetables</button> <button class="btn" data-filter=".women">Chapati</button> </div> </div> <div class="container"> <div class="row karl-new-arrivals"> <?php $product_array = $db_handle->runQuery("SELECT * FROM shop ORDER BY id ASC"); if (!empty($product_array)) { foreach($product_array as $key=>$value){ ?> <!-- Single gallery Item Start --> <div class="col-12 col-sm-6 col-md-4 single_gallery_item wow fadeInUpBig" data-wow-delay="0.2s"> <form method="post" action="shop.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>" > <!-- Product Image --> <div class="product-img"> <?php echo "<img src='../images/".$product_array[$key]['image']."'>"; ?> </div> <!-- Product Description --> <div class="product-description"> <p><?php echo $product_array[$key]["name"]; ?></p> <h4 class="product-price"><?php echo number_format($product_array[$key]["price"])."/-"; ?></h4> <div class="quantity"> <input type="number" class="qty-text" id="qty" step="1" min="1" max="1000" name="quantity" value="1"> </div> <!-- Add to Cart --> <input type="submit" value="ADD TO CART" class="add-to-cart" /> </div> </div> </form> <?php } } ?> </div> </div> </section> <!-- ****** New Arrivals Area End ****** --> <br> <b style="color:purple;font-size: 14px;text-align: center;margin-left: 25%"> Pilau City © <script>document.write(new Date().getFullYear());</script></b> </div> </div> </div> <div id="wrapper"> <!-- ****** Header Area Start ****** --> <header class="header_area bg-img background-overlay-white" style="background-image: url(../images/rice5.jpg);"> <!-- Top Header Area Start --> <div class="top_header_area"> <div class="container h-100"> <div class="row h-100 align-items-center justify-content-center"> <div class="col-12 col-lg-7"> <div class="top_single_area d-flex align-items-center"> <!-- Logo Area --> <div class="top_logo"> <a href="../index.php"><img class="heartbeat" src="../img/logo.png" alt=""></a> </div> <!-- Cart & Menu Area --> <div class="header-cart-menu d-flex align-items-center ml-auto"> <!--Cart--> <!--Cart icon start--> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> <!-- Cart Area --> <div class="cart"> <a href="#" id="header-cart-btn" target="_blank"><span class="cart_quantity"><?php echo $total_quantity; ?></span> <i class="ti-bag"></i><?php echo number_format($total_price); ?>/-</a> <!-- Cart List Area Start --> <ul class="cart-list"> <div class="cart-item-desc"> <ul class="cart-list"> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <li> <a href="#" class="image cart-thumb"><?php echo "<img src='../db/images/".$item['image']."'>"; ?></a> <div class="cart-item-desc"> <h6><a href="#"><?php echo $item["name"]; ?></a></h6> <p><?php echo $item["quantity"]; ?> * <span class="price"><?php echo "UGX ".number_format($item["price"]); ?>/-</span> <a href="../shop/index.php?action=remove&code=<?php echo $item["code"]; ?>" class="btnRemoveAction"><i class="fa fa-close"></i></a> <br> <span class="price">Total: <?php echo "UGX ".number_format($item_price); ?>/-</span> </p> </div> <span class="dropdown-product-remove"><i class="icon-cross"></i></span> </li> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> <li class="total"> <span class="pull-right">Total: <?php echo number_format($total_price); ?>/-</span> <a href="../shop/index.php?action=empty" class="btn btn-sm btn-cart">Empty</a> <a href="../checkout" class="btn btn-sm btn-checkout">Proceed</a> </li> </ul> </div> <?php } else { ?> <?php } ?> </ul> </div> <!--Cart icon with quantity end--> <?php } else { ?> <!--Cart icon without quantity--> <div class="cart"> <a href="#" id="header-cart-btn" target="_blank"><span class="cart_quantity">0</span> <i class="ti-bag"></i>0/-</a> <!-- Cart List Area Start --> <ul class="cart-list"> <div class="cart-item-desc"> <div class="no-records">Your Cart is Empty <br> <a href="../shop">Go Shopping</a></div> </div> </ul> </div> <!--Cart icon without quantity end--> <?php } ?> <!--Shopping Cart icon end--> <div class="header-right-side-menu ml-15"> <a href="#" id="sideMenuBtn"><i class="ti-menu"></i></a> </div> </div> </div> </div> </div> </div> </div> <!-- Top Header Area End --> <div class="main_header_area"> <div class="container h-100"> <div class="row h-100"> <div class="col-12 d-md-flex justify-content-between"> <!-- Header Social Area --> <div class="header-social-area"> <a href="#"><span class="karl-level">Share</span> <i class="fa fa-pinterest" aria-hidden="true"></i></a> <a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a> <a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a> <a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a> </div> <!-- Menu Area --> <div class="main-menu-area"> <nav class="navbar navbar-expand-lg align-items-start"> <div class="navbar-toggler" type="button" data-toggle="collapse" data-target="#karl-navbar" aria-controls="karl-navbar" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon">Menu</span></div> <div class="collapse navbar-collapse align-items-start collapse" id="karl-navbar"> <ul class="navbar-nav animated" id="nav"> <li class="nav-item active"><a class="nav-link" href="../menu">Full Menu</a></li> <li class="nav-item"><a class="nav-link" href="../menu/rice.php">Rice</a></li> <li class="nav-item"><a class="nav-link" href="../menu/chapati.php">Chapati</a></li> <li class="nav-item"><a class="nav-link" href="../menu/hotdogs.php">Hot Dogs</a></li> <li class="nav-item"><a class="nav-link" href="../menu/drinks.php">Drinks</a></li> </ul> </div> </nav> </div> <!-- Help Line --> <div class="help-line"> <a href="../coming soon/index.php"><i class="ti-headphone-alt"></i> Chat With Us</a> </div> </div> </div> </div> </div> </header> <!-- ****** Header Area End ****** --> <!-- ****** Cart Area Start ****** --> <div class="cart_area section_padding_100 clearfix"> <div class="container"> <div class="row"> <div class="col-12"> <div class="cart-table clearfix"> <table class="table table-responsive"> <thead> <tr> <th>Product</th> <th>Name</th> <th>Price</th> <th>Quantity</th> <th>Total</th> </tr> </thead> <tbody> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <tr> <td class="cart_product_img d-flex align-items-center"> <a href="#"><?php echo "<img src='../db/images/".$item['image']."' width='60%'>"; ?></a> </td> <td><span><?php echo $item["name"]; ?></span></td> <td class="price"><span><?php echo "UGX ".number_format($item["price"]); ?></span></td> <td class="qty"> <div class="quantity"> <span> <?php echo $item["quantity"]; ?> </span> </div> </td> <td class="total_price"><span><?php echo "UGX ".number_format($item_price); ?></span></td> </tr> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> <?php } else { ?> <!--Cart when empty--> <td> <b>Your Cart is Empty</b> </td> <!--Cart when empty end--> <?php } ?> </tbody> </table> </div> <?php if(isset($_SESSION["cart_item"])){ ?> <div class="cart-footer d-flex mt-30"> <div class="back-to-shop w-50"> <a href="../shop">Continue Shopping</a> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); ?> <?php } else { ?> <a href="../shop">Start Shopping</a> </div> </div> <?php } ?> <!--Cart when empty--> </div> </div> <div class="row"> <div class="col-12 col-lg-4"> <div class="cart-total-area mt-70"> <div class="cart-page-heading"> <h5 align="center">Cart total</h5> </div> <!--Cart totals--> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; $total_amount = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); $total_amount = ($total_price+5000); } ?> <ul class="cart-total-chart"> <li><span>Subtotal</span> <span><?php echo "UGX ".number_format($total_price); ?></span></li> <li><span>Delivery</span> <span>UGX 5,000</span></li> <li><span><strong>Total</strong></span> <span><strong><?php echo "UGX ".number_format($total_amount); ?></strong></span></li> </ul> <a href="../checkout" class="btn karl-checkout-btn">Proceed to checkout</a> <?php } else { ?> <!-- Cart total without quantity--> <ul class="cart-total-chart"> <li> <span><strong>You have not made any orders yet</strong></span></li> </ul> <a href="../shop" class="btn karl-checkout-btn">Click Me</a> <!--Cart total quantity end--> <?php } ?> </div> </div> </div> </div> </div> <!-- ****** Cart Area End ****** --> <!-- ****** Footer Area Start ****** --> <footer class="footer_area"> <div class="container"> <div class="row"> <!-- Single Footer Area Start --> <div class="col-12 col-sm-16 col-md-23 col-lg-22"> <div class="single_footer_area"> <ul class="footer_widget_menu" style="margin-left: 15%"> <li><a href="../coming soon/index.php">About</a></li> <li><a href="../coming soon/index.php">Contact Us</a></li> <li><a href="../coming soon/index.php">Deliveries</a></li> <li><a href="../coming soon/index.php">Our Policies</a></li> </ul> </div> </div> <br> <!-- Single Footer Area Start --> <div class="col-12 col-lg-15"> <div class="single_footer_area"> <div class="footer_heading mb-30"> <h6>Subscribe to our newsletter</h6> </div> <div class="subscribtion_form"> <form action="#" method="post"> <input type="email" name="mail" class="mail" placeholder="Your email here"> <button type="submit" class="submit">Subscribe</button> </form> </div> </div> </div> </div> <div class="line"></div> <!-- Footer Bottom Area Start --> <div class="footer_bottom_area"> <div class="row"> <div class="col-12"> <div class="footer_social_area text-center"> <a href="#"><i class="fa fa-pinterest" aria-hidden="true"></i></a> <a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a> <a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a> <a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a> </div> </div> </div> </div> <div class="copywrite_text align-items-center"> <p align="center"><a href="../index.php" target="_blank"><b style="color: purple">Pilau City</b></a> <br> Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved <br> Designed by <a href="https://customassistmonitor.xyz" target="_blank">Custom Assist</a></p> </div> </div> </footer> <!-- ****** Footer Area End ****** --> </div> <!-- /.wrapper end --> <!-- jQuery (Necessary for All JavaScript Plugins) --> <script src="../js/jquery/jquery-2.2.4.min.js"></script> <!-- Popper js --> <script src="../js/popper.min.js"></script> <!-- Bootstrap js --> <script src="../js/bootstrap.min.js"></script> <!-- Plugins js --> <script src="../js/plugins.js"></script> <!-- Active js --> <script src="../js/active.js"></script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 2.7 |
proxy
|
phpinfo
|
Settings