Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium163.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : infihsqw ( 644)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /home/infihsqw/public_html/old/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/infihsqw/public_html/old/categories.php
<?php
include 'controlPanel/Database.php';
$db = new Database();
if (!isset($_SESSION["user"])) {
    $_SESSION["user"] = rand();
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $user = $_SESSION["user"];
    if (!empty($_POST['product_id']) and !empty($user)){
        $product_id = $_POST["product_id"];

        $query = "SELECT * FROM cart WHERE product_id = $product_id AND user = '$user'";
        $result = $db->dbQuery($query);
        
        if ($db->dbNumRows($result) > 0) {
            $query = "UPDATE cart SET quantity=(quantity+1) WHERE product_id = $product_id AND user = '$user'";
            $result = $db->dbQuery($query);
            if ($result) {
                header("location:cart.php");
            }else{
                echo "no";
            }
        }else {
            $query = "INSERT INTO cart (product_id, quantity, user) VALUES ($product_id, 1, '$user')";
            $result = $db->dbQuery($query);
            if ($result) {
                header("location:cart.php");
            }else{
                echo "no1";
            }

        }
    }else{
        header("location:index.php");
        
    }
}

$category_id = $_GET['category_id'];
$query = "SELECT title FROM `subclasses` WHERE `id` = $category_id";
$result = $db->dbQuery($query);
                   
if($db->dbNumRows( $result)){
    $rows = $db->dbFetchResult($result);
    foreach($rows as $row){ 
        $title = $row['title'];
    }
}

?>

<html lang="ar" dir="rtl">
    <head>
    <?php include "head.php"; ?>
</head>

<body style="overflow: auto;" data-new-gr-c-s-check-loaded="14.1125.0" data-gr-ext-installed="">
    <div class="loaderk d-flex justify-content-center align-items-center" style="display: none; height: 0px;"> 
    </div>
    <?php include "header.php"; ?>
    <main>
        <section class="mt-5 py-3">
</section>
<section class="container-fluid">

    <nav aria-label="breadcrumb" style="margin-top: 15px;">
        <ol class="breadcrumb pt-md-0 pt-2">
            <li class="breadcrumb-item"><a href="index.php" class=" text-dark">الرئيسية</a></li>
            <li class="breadcrumb-item active" aria-current="page"><?= $title ?></li>
        </ol>
    </nav>
    <h5 class="text-start text-secondary container-fluid">
        <?= $title ?>
    </h5>
    <!-- itmes -->
    <div class="container">
        <div class="row">
        <?php
            
                   $query = "SELECT * FROM `products` WHERE `category_id` = $category_id ORDER BY `product_id` DESC";
                   $result = $db->dbQuery($query);
                   
                   if($db->dbNumRows( $result)){
                   $rows = $db->dbFetchResult($result);
                   foreach($rows as $row){ ?>
                   <div class="col-md-3 col-6 mb-2">
                    <a href="product.php?product_id=<?= $row['product_id']; ?>" class="text-decoration-none">
                        <div class="product">
                            <img src="uploads/<?= $row['image']; ?>" class="w-100 " alt="<?= $row['name']; ?>">
                            <div class="container position-relative">
                                <p class="productName my-0 mt-2 mb-1"><?= $row['name']; ?></p>
                                <p class="mb-2 text-secondary text-center">
                                    <span><?= $row['dec'] == 0 ? $row['price'] : $row['dec']; ?></span>
                                    <span>ر.س</span>
                                </p>
                                <div>
                                    <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST">
                                        <input type="hidden" name="qnt" value="1" id="">
                                        <input type="hidden" name="product_id" value="<?= $row['product_id']; ?>" id="">
                                        <button type="submit" name="addCart" class="btn btn-sm btn-dark w-100">
                                            إضافة للسلة
                                        </button>

                                    </form>
                                </div>
                            </div>
                        </div>
                    </a>
                </div>
            <?php } } ?>
            </div>
    </div>
</section>


<a href="https://wa.me/<?= $Whatsapp ?>" class="contact py-2 px-3 bg-success rounded-circle">
    <i class="fab fa-whatsapp text-white my-1 fa-2x"></i>
</a>
</main>
<?php 
include "footer.php"; 
include "script.php"; 
?>


</body>
</html>

ZeroDay Forums Mini