File manager - Edit - /home/custbahd/irungikitchen.com/admin/rewards/index1.php
Back
<?php session_start(); include_once "../counter/db/config.php"; include '../db/saucerer.php'; // Define variables and initialize with empty values $id = $name = $token = $access = ""; $id_err = $name_err = $token_err = $access = ""; // Check if the user is logged in, if not then redirect him to login page if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] != true){ $loggedin = ""; header("location: ../secure"); exit; } elseif(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] == true){ $loggedin = $_SESSION['loggedin']; $id = $_SESSION['id']; $token = $_SESSION['token']; // of college_data table $sql = "SELECT * FROM secure WHERE token='$token'"; $result = $conn->query($sql); // Display data on web page while($row = mysqli_fetch_array($result)) { $id = $row['id']; $name = $row['name']; $token = $row['token']; } } // Generating a random number date_default_timezone_set('Africa/Kampala'); $today = date("His-dmY",time()); $code1 = rand(1,9); $code2 = rand(1,9); $code3 = $code1 * $code2; $tokens = "$code3-$today"; ?> <?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 id='" . $_GET["id"] . "'"); $itemArray = array($productByCode[0]["id"]=>array('name'=>$productByCode[0]["name"], 'id'=>$productByCode[0]["id"], 'quantity'=>$_POST["quantity"], 'cat'=>$productByCode[0]["cat"], 'label_1'=>$productByCode[0]["label_1"], 'price_1'=>$productByCode[0]["price_1"], 'label_2'=>$productByCode[0]["label_2"], 'price_2'=>$productByCode[0]["price_2"], 'label_3'=>$productByCode[0]["label_3"], 'price_3'=>$productByCode[0]["price_3"], 'image'=>$productByCode[0]["image"])); if(!empty($_SESSION["cart_item"])) { if(in_array($productByCode[0]["id"],array_keys($_SESSION["cart_item"]))) { foreach($_SESSION["cart_item"] as $k => $v) { if($productByCode[0]["id"] == $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["id"] == $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 class="no-js" xmlns:og="http://ogp.me/ns#"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Rewards | Irungi Kitchen ©</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Place favicon.ico in the root directory --> <link rel="icon" href="../img/fav-icon.png" type="image/x-icon" /> <!--Boxicons--> <link href="../boxicon.min.css" rel="stylesheet"> <!--Animations--> <link rel="stylesheet" type="text/css" href="../css/animations/style.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/blink.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/bounce.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/flicker.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/jello.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/pulsate.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/shake.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/vibrate.css"> <link rel="stylesheet" type="text/css" href="../css/animations/attention/wobble.css"> <!--CSS--> <link rel="stylesheet" type="text/css" href="../css/bootstrap/bootstrap.css"> <link rel="stylesheet" type="text/css" href="../datatable/dataTable.bootstrap.min.css"> <!-- Modernizr JS --> <script src="../js/vendor/modernizr-2.8.3.min.js"></script> <style type="text/css"> body { background-image: url(../img/error-bg1.jpg); background-attachment: fixed; background-position: top; } /*Logo Section*/ .logo img{ border-radius: 100px; } table { padding: 30px; border-radius: 10px; background: #f195b2; } /*Welcome Section*/ .welcome-section .welcome-content a{ color: #000; text-decoration: underline; } /*Wishlist Section*/ .wishlist-section .cart-table .table th { text-align: left; width: 120px; padding-bottom: 20px; border-bottom: 1px solid rgba(0, 0, 0, 0.4); } .wishlist-section .cart-table .table:last-child th { text-align: center; padding-bottom: 10px; } .wishlist-section .cart-table .table td { text-align: center; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(0, 0, 0, 0.4); } .wishlist-section .cart-table .table img { width: 50px; height: 50px; object-fit: cover; border-radius: 3px; } .wishlist-section .cart-table .table .pro-thumbnail { width: 160px; } /*Home Link Button*/ a.view{ background: #000; color: #f195b2; text-decoration: none; text-transform: uppercase; line-height: 36px; padding: 10px; font-size: 12px; font-weight: 600; border-radius: 3px; border: none; cursor: pointer; transition: 1s; } a.view:hover { color: #f195b2; background: #fff; } /*Home Link Button*/ .home_btn a{ background: #f195b2; color: #000; text-decoration: none !important; text-transform: uppercase; line-height: 36px; padding: 10px 40px; font-size: 14px; font-weight: 600; border-radius: 3px; border: none; cursor: pointer; transition: 1s; } .home_btn a i { margin-right: 10px; } .home_btn a:hover { color: #f195b2; background: #000; } /*Copyright Section*/ .copyright-section .copyright-content p:first-child{ color: rgba(0, 0, 0, 0.7); margin-top: 40px; } .copyright-section .copyright-content p:last-child{ color: rgba(0, 0, 0, 0.7); font-size: 12px; } .copyright-section .copyright-content a{ color: rgba(0, 0, 0, 0.7); text-decoration: none; } </style> </head> <body> <div id="main-wrapper"> <div class="logo" align="center"> <a href="../"><img src="../img/il.png" alt="Irungi Kitchen"></a> </div> <br> <?php if(isset($_SESSION['error'])){ echo " <br> <div class='alert alert-danger text-center'> <button class='close'>×</button> ".$_SESSION['error']." </div> "; unset($_SESSION['error']); } if(isset($_SESSION['success'])){ echo " <br> <div class='alert alert-success text-center'> <button class='close'>×</button> ".$_SESSION['success']." </div> "; unset($_SESSION['success']); } ?> <!-- Welcome Section Start --> <div class="welcome-section"> <div class="container"> <div class="row align-items-center"> <div class=""> <div class="welcome-content" align="center"> <h2>REWARD CENTER</h2> <?php $sql = "SELECT SUM(reward) from clients"; $result = $conn->query($sql); //display data on web page while($row = mysqli_fetch_array($result)){ echo " Total rewards: ". number_format($row['SUM(reward)']); echo "<br>"; } //sql query $sql = "SELECT SUM(total) from checkout_admin"; $result = $conn->query($sql); //display data on web page while($row = mysqli_fetch_array($result)){ echo " Total orders: ". number_format($row['SUM(total)']); echo "<br>"; } ?> </div> </div> </div> </div> <br> <!-- Welcome Section End --> <!--Wishlist section start--> <div class="wishlist-section"> <div class="container"> <div class="row"> <div class="col-12"> <!-- Cart Table --> <div class="cart-table"> <table class="table" align="center"> <thead> <tr> <th class="pro-thumbnail">Names</th> <th class="pro-stock">Reward</th> <th class="pro-stock">ACTION</th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM clients ORDER BY id DESC"; //use for MySQLi-OOP $query = $conn->query($sql); while($row = $query->fetch_assoc()){ echo "<tr>"; echo "<td>"; echo "".$row['fname']." ".$row['lname'].""; echo "</td>"; echo "<td>"; if ($row['reward']) { echo "<span class='total'><b>".number_format($row['reward'])."</b></span>"; } else { echo "<span class='total'><b>-</b></span>"; } echo "</td>"; echo "<td class='pro-stock'> <a href='#edit_".$row['id']."' data-toggle='modal' class='view'>MANAGE</a> </td>"; echo "</tr>"; include('edit_delete_modal.php'); } ?> </tbody> </table> </div> </div> </div> </div> </div> <br> <br> <!--Wishlist section end--> <!-- Copyright Section Start --> <div class="copyright-section"> <div class="container"> <div class="row align-items-center"> <div class=""> <div class="copyright-content" align="center"> <p>Irungi Kitchen © <script>document.write(new Date().getFullYear());</script></p> <p>Powered by <a target="_blank" href="https://customassistinc.com">Custom Assist Inc.</a></p> </div> </div> </div> </div> <!-- Copyright Section End --> </div> <script src="../js/jquery/jquery.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/datatable/jquery.dataTables.min.js"></script> <script src="../js/datatable/dataTable.bootstrap.min.js"></script> <script> $(document).ready(function(){ //inialize datatable $('#myTable').DataTable(); //hide alert $(document).on('click', '.close', function(){ $('.alert').hide(); }) }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 0.8 |
proxy
|
phpinfo
|
Settings