File manager - Edit - /home/custbahd/irungikitchen.com/admin1/contact/index.php
Back
<?php session_start(); //including the database connection file include_once("../../db/config.php"); ?> <?php 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 checkout WHERE code='" . $_GET["code"] . "'"); $itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'type'=>$productByCode[0]["type"], 'quantity'=>$_POST["quantity"], 'price'=>$productByCode[0]["price"], 'image'=>$productByCode[0]["image"])); $productByCode = $db_handle->runQuery("SELECT * FROM home_products WHERE code='" . $_GET["code"] . "'"); $itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'type'=>$productByCode[0]["type"], '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; } } ?> <?php //while($res = mysql_fetch_array($result)) { // mysql_fetch_array is deprecated, we need to use mysqli_fetch_array include_once("../../db/config.php"); ?> <!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>Contact | 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="../assets/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"> <!-- Modernizr JS --> <script src="../../assets/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 { width: 400px; padding: 30px; margin-bottom: 20px; border-radius: 10px; border-top-left-radius: 0; background: #f195b2; } /*Welcome Section*/ .welcome-section .welcome-content a{ color: #000; text-decoration: underline; } /*Wishlist Section*/ .wishlist-section .cart-table .table tr:first-child td i{ padding-right: 5px; padding-bottom: 20px; } .wishlist-section .cart-table .table td { text-align: left; padding-bottom: 10px; } .wishlist-section .cart-table .table .pro-price a, .wishlist-section .cart-table .table .pro-title a{ text-decoration: none; color: black; } .wishlist-section .cart-table .table img { width: 50px; height: 50px; object-fit: cover; border-radius: 3px; } .wishlist-section .cart-table .table .in-stock { font-size: 12px; color: rgba(0, 0, 0, 0.7); } .wishlist-section .cart-table .table .pro-price { padding-left: 20px; } /*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-top: 10px; 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> <!-- Welcome Section Start --> <div class="welcome-section"> <div class="container"> <div class="row align-items-center"> <div class=""> <div class="welcome-content" align="center"> <?php $sql = "SELECT * FROM contact"; //use for MySQLi-OOP $query = $conn->query($sql); if($row = $query->fetch_assoc() == 0) { echo"<h2>NO MESSAGES</h2>"; echo "<div class='home_btn' align='center'><a href='../'><i class='bx bx-caret-left'></i> GO BACK </a></div>"; }else { echo"<h2>MESSAGES</h2>"; } ?> </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"> <?php $sql = "SELECT * FROM contact ORDER BY id DESC"; //use for MySQLi-OOP $query = $conn->query($sql); while($row = $query->fetch_assoc()){ date_default_timezone_set('Africa/Kampala'); $start_count = date("Y-m-d H:i:s", strtotime($row['timestamp'] . "+1 days")); $today = date("Y-m-d H:i:s",time()); $start_diff = new DateTimeImmutable($row['timestamp']); $endd_diff = new DateTimeImmutable($today); $duration = $start_diff->diff($endd_diff); $today_diff = new DateTimeImmutable($today); $days_diff = $today_diff->diff($start_diff); echo "<table class='table' align='center'>"; echo "<tbody>"; echo "<tr>"; echo "<td><i class='bx bx-user'></i> ".$row['name']."</td>"; echo "</tr>"; echo "<tr>"; echo "<td class='pro-title'><span> <a href='tel:".$row['phone']."'>".$row['phone']." </a></span></td>"; echo "<td class='pro-price'><a href='mailto:".$row['email']."'> ".$row['email']."</a> </td>"; echo "</tr>"; echo "<tr>"; echo "<td>Message</td>"; echo "<td class='pro-price' style='line-height: 45px;'><span> ".substr($row['message'], 0, 20)." </span></td>"; echo "</tr>"; echo "<tr>"; echo "<td class='pro-stock'>"; echo "<span class='in-stock'>"; if ($days_diff->format('%i')==0 & $days_diff->format('%h')==0 & $days_diff->format('%d')==0 & $days_diff->format('%m')==0 & $days_diff->format('%y')==0) { echo "Just Now"; } elseif ($days_diff->format('%i')>=0 & $days_diff->format('%h')>=0 & $days_diff->format('%d')>=0 & $days_diff->format('%m')>=0 & $days_diff->format('%y')==1) { echo "Last Year on ".date("D, jS M", strtotime($row['timestamp'])).""; } elseif ($days_diff->format('%i')>=0 & $days_diff->format('%h')>=0 & $days_diff->format('%d')>=0 & $days_diff->format('%m')>=0 & $days_diff->format('%y')>=1) { echo "".$days_diff->format("%y years")." ago on ".date("D, jS M", strtotime($row['timestamp'])).""; } elseif ($days_diff->format('%i')==1 & $days_diff->format('%h')==0 & $days_diff->format('%d')==0) { echo "".$days_diff->format("%i minute")." ago"; } elseif ($days_diff->format('%i')>=0 & $days_diff->format('%h')==0 & $days_diff->format('%d')==0) { echo "".$days_diff->format("%i minutes")." ago"; } elseif ($days_diff->format('%h')==1 & $days_diff->format('%d')==0 & $days_diff->format('%m')==0) { echo "".$days_diff->format("%h hour")." ago"; } elseif ($days_diff->format('%h')>=0 & $days_diff->format('%d')==0 & $days_diff->format('%m')==0) { echo "".$days_diff->format("%h hours")." ago"; } elseif ($days_diff->format('%d')==1) { echo "Yesterday at ".date("H:i", strtotime($row['timestamp'])).""; } elseif ($days_diff->format('%m')==0) { echo "".$days_diff->format("%d days")." ago at ".date("H:i", strtotime($row['timestamp'])).""; } elseif ($days_diff->format('%m')==1) { echo "Last Month on ".date("jS D", strtotime($row['timestamp'])).""; } elseif ($days_diff->format('%m')>=1) { echo "".$days_diff->format("%m months")." ago on ".date("jS D", strtotime($row['timestamp'])).""; } echo "</span>"; echo "</td>"; echo "<td><a href='chat/?id=".$row['id']."' class='view'>VIEW DETAILS</a></td>"; echo "</tr>"; echo "</tbody>"; echo "</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> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 1.4 |
proxy
|
phpinfo
|
Settings