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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/domains/sabrinaluxebraidedwigs.com/public_html/action.php
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
//create a cookie so we can track add to cart
if( !isset($_COOKIE["cart"])){
	$ip_add = substr(md5(rand()), 0, 20);
	setcookie("cart", "$ip_add");
}
else{
	$ip_add = $_COOKIE["cart"];
}
include("minks.php");
if(isset($_SESSION["user_id"])){
$user_id = $_SESSION["user_id"];

}
if(isset($_POST["category"])){
	$category_query = "SELECT * FROM categories";
	$run_query = mysqli_query($con,$category_query) or die(mysqli_error($con));
	echo "
		<div class='nav nav-pills nav-stacked'>
			
	";
	if(mysqli_num_rows($run_query) > 0){
		while($row = mysqli_fetch_array($run_query)){
			$cid = $row["cat_id"];
			$cat_name = $row["cat_title"];
			echo "
					<li><a href='#' class='category' cid='$cid'>$cat_name</a></li>
			";
		}
		echo "</div>";
	}
}
if(isset($_POST["brand"])){
	$brand_query = "SELECT * FROM brands";
	$run_query = mysqli_query($con,$brand_query);
	echo "
		<div class='nav nav-pills nav-stacked'>
			
	";
	if(mysqli_num_rows($run_query) > 0){
		while($row = mysqli_fetch_array($run_query)){
			$bid = $row["brand_id"];
			$brand_name = $row["brand_title"];
			echo "
					<li><a href='#' class='selectBrand' bid='$bid'>$brand_name</a></li>
			";
		}
		echo "</div>";
	}
}
if(isset($_POST["page"])){
	$sql = "SELECT * FROM products WHERE in_stock='yes'";
	$run_query = mysqli_query($con,$sql);
	$count = mysqli_num_rows($run_query);
	$pageno = ceil($count/9);
	for($i=1;$i<=$pageno;$i++){
		echo "
			<li><a href='#' page='$i' id='page'>$i</a></li>
		";
	}
}
if(isset($_POST["getProduct"])){
	$limit = 12;
	if(isset($_POST["setPage"])){
		$pageno = $_POST["pageNumber"];
		$start = ($pageno * $limit) - $limit;
	}else{
		$start = 0;
	}
	$product_query = "SELECT * FROM products WHERE in_stock='yes' LIMIT $start,$limit";
	$run_query = mysqli_query($con,$product_query);
	if(mysqli_num_rows($run_query) > 0){
		while($row = mysqli_fetch_array($run_query)){
			$pro_id    = $row['product_id'];
			$pro_cat   = $row['product_cat'];
			$pro_brand = $row['product_brand'];
			$pro_title = $row['product_title'];
			$pro_price = $row['product_price'];
			$pro_image = $row['product_image'];
			$old_price = $row['old_price'];
			$new = $row['new'];
			
			if($new == "yes"){$new_tag = "<span class='product-new-top'>New</span>";}
			else{$new_tag = "";}
			if($old_price == ""){
				$discounted_price = $pro_price;
				$cancelled_price = "<del style='height:50px;'><br/></del>";
				$percent_tag ="";
			}
			if(!$old_price == ""){
			$full_price = $pro_price;
			$percent_off = $old_price;
			$percent_tag = "<span class='product-percent-top'>$percent_off% off</span>";
			
			$percentInDecimal = $percent_off / 100;
			$percent = $percentInDecimal * $full_price;
			$discounted_price = $full_price - $percent;
			$cancelled_price = "<del style='height:50px;'>N$full_price.00</del>";
			}
			echo "
				<div class='col-md-3 product-men'>
								<div class='men-pro-item simpleCart_shelfItem'>
									<div class='men-thumb-item'>
										<img src='product_images/$pro_image' alt='' class='pro-image-front'>
										<img src='product_images/$pro_image' alt='' class='pro-image-back'>
											<div class='men-cart-pro'>
												<div class='inner-men-cart-pro'>
													<a href='view.php?u=$pro_id' class='link-product-add-cart'>Quick View</a>
												</div>
											</div>
											$new_tag
											$percent_tag
											
											
											
									</div>
									<div class='item-info-product '>
										<h4 style='height:50px;'><a href='view.php?u=$pro_id' >$pro_title</a></h4>
										<div class='info-product-price'>
											<span class='item_price'>N$discounted_price.00</span>
											$cancelled_price
										</div>
										<div class='snipcart-details top_brand_home_details item_add single-item hvr-outline-out button2'>
												
											<button pid='$pro_id' id='product' class='button'>Add To Cart</button>
										</div>
										
																			
									</div>
								</div>
							</div>	
			";
		}
	}
}
if(isset($_POST["get_seleted_Category"]) || isset($_POST["selectBrand"]) || isset($_POST["search"])){
	if(isset($_POST["get_seleted_Category"])){
		$id = $_POST["cat_id"];
		$sql = "SELECT * FROM products WHERE product_cat = '$id'";
	}else if(isset($_POST["selectBrand"])){
		$id = $_POST["brand_id"];
		$sql = "SELECT * FROM products WHERE product_brand = '$id'";
	}else {
		$keyword = $_POST["keyword"];
		$sql = "SELECT * FROM products WHERE product_keywords LIKE '%$keyword%'";
	}
	
	$run_query = mysqli_query($con,$sql);
	while($row=mysqli_fetch_array($run_query)){
			$pro_id    = $row['product_id'];
			$pro_cat   = $row['product_cat'];
			$pro_brand = $row['product_brand'];
			$pro_title = $row['product_title'];
			$pro_price = $row['product_price'];
			$pro_image = $row['product_image'];
			$old_price = $row['old_price'];
			echo "
				<div class='col-md-3 product-men'>
								<div class='men-pro-item simpleCart_shelfItem'>
									<div class='men-thumb-item'>
										<img src='product_images/$pro_image' alt='' class='pro-image-front'>
										<img src='product_images/$pro_image' alt='' class='pro-image-back'>
											<div class='men-cart-pro'>
												<div class='inner-men-cart-pro'>
													<a href='view.php?u=$pro_id' class='link-product-add-cart'>Quick View</a>
												</div>
											</div>
											
											
									</div>
									<div class='item-info-product '>
										<h4><a href='view.php?u=$pro_id'>$pro_title</a></h4>
										<div class='info-product-price'>
											<span class='item_price'>N$pro_price.00</span>
											<del>N$old_price.00</del>
										</div>
										<div class='snipcart-details top_brand_home_details item_add single-item hvr-outline-out button2'>
												
											<button pid='$pro_id'' id='product' class='button'>Add To Cart</button>
										</div>
										
																			
									</div>
								</div>
							</div>	
			";
		}
	}
	


	if(isset($_POST["addToCart"])){
		

		$p_id = $_POST["proId"];
		

		if(isset($_SESSION["user_id"])){

		$user_id = $_SESSION["user_id"];

		$sql = "SELECT * FROM cart WHERE p_id = '$p_id' AND ip_add = '$ip_add'";
		$run_query = mysqli_query($con,$sql);
		$count = mysqli_num_rows($run_query);
		if($count > 0){
			$get_product_name = mysqli_query($con,"SELECT product_title FROM products WHERE product_id='$p_id'");
				while($row = mysqli_fetch_array($get_product_name)){
					$product_name = $row['product_title'];}
				echo "
					<script>
					swal('$product_name', 'is already in your cart.', 'info');
					</script>
				";
		} else {
			$sql = "INSERT INTO `cart`
			(`p_id`, `ip_add`, `user_id`, `qty`) 
			VALUES ('$p_id','$ip_add','$user_id','1')";
			if(mysqli_query($con,$sql)){
				$get_product_name = mysqli_query($con,"SELECT product_title FROM products WHERE product_id='$p_id'");
				while($row = mysqli_fetch_array($get_product_name)){
					$product_name = $row['product_title'];}
				echo "
					<script>
					swal('$product_name', 'has been added to your cart.', 'success');
					</script>
				";
			}
		}
		}else{
			$sql = "SELECT id FROM cart WHERE ip_add = '$ip_add' AND p_id = '$p_id'";
			$query = mysqli_query($con,$sql);
			if (mysqli_num_rows($query) > 0) {
				$get_product_name = mysqli_query($con,"SELECT product_title FROM products WHERE product_id='$p_id'");
				while($row = mysqli_fetch_array($get_product_name)){
					$product_name = $row['product_title'];}
				echo "
					
					<script>
					swal('$product_name', 'is already in your cart.', 'info');
					</script>
				";
					exit();
			}
			$sql = "INSERT INTO `cart`
			(`p_id`, `ip_add`, `user_id`, `qty`) 
			VALUES ('$p_id','$ip_add','-1','1')";
			if (mysqli_query($con,$sql)) {
				$get_product_name = mysqli_query($con,"SELECT product_title FROM products WHERE product_id='$p_id'");
				while($row = mysqli_fetch_array($get_product_name)){
					$product_name = $row['product_title'];}
				echo "
					<script>
					swal('$product_name', 'has been added to your cart.', 'success');
					</script>
				";
				exit();
			}
			
		}
		
		
		
		
	}

//Count User cart item
if (isset($_POST["count_item"])) {
	//When user is logged in then we will count number of item in cart by using user session id
	if (isset($_SESSION["user_id"])) {
		$sql = "SELECT COUNT(*) AS count_item FROM cart WHERE ip_add = '$ip_add'";
	}else{
		//When user is not logged in then we will count number of item in cart by using users unique ip address
		$sql = "SELECT COUNT(*) AS count_item FROM cart WHERE ip_add = '$ip_add'";
	}
	
	$query = mysqli_query($con,$sql);
	$row = mysqli_fetch_array($query);
	echo $row["count_item"];
	exit();
}
//Count User cart item

//Get Cart Item From Database to Dropdown menu
if (isset($_POST["Common"])) {

	if (isset($_SESSION["user_id"])) {
		//When user is logged in this query will execute
		$sql = "SELECT a.product_id,a.product_title,a.product_price,a.old_price,a.product_image,b.id,b.qty FROM products a,cart b WHERE a.product_id=b.p_id AND b.ip_add = '$ip_add'";
	}else{
		//When user is not logged in this query will execute
		$sql = "SELECT a.product_id,a.product_title,a.product_price,a.old_price,a.product_image,b.id,b.qty FROM products a,cart b WHERE a.product_id=b.p_id AND b.ip_add='$ip_add'";
	}
	$current_total=0;
	$query = mysqli_query($con,$sql);
	if (isset($_POST["getCartItem"])) {
		//display cart item in dropdown menu
		if (mysqli_num_rows($query) > 0) {
			$n=0;
			while ($row=mysqli_fetch_array($query)) {
				$n++;
				$product_id = $row["product_id"];
				$product_title = $row["product_title"];
				$product_price = $row["product_price"];
				$product_image = $row["product_image"];
				$cart_item_id = $row["id"];
				$qty = $row["qty"];

				//get total
				$current_total += $product_price * $qty;

				echo '
				<ul class="header-cart-wrapitem">
						<li class="header-cart-item">
							<div class="header-cart-item-img">
							<img src="'.$admin_no.'/assets/img/products/'.$product_image.'" alt="IMG" style="border-radius:5px;">
							</div>
							<div class="header-cart-item-txt">
							<a style="color:black;" href="product_details.php?product='.$product_id.'" class="header-cart-item-name">
							'.$product_title.'
							</a>
							<span class="header-cart-item-info">'.$qty.' x 
							';echo $currency; echo number_format((float)$product_price, 2, '.', ','); echo'
							</span>
							</div>
						</li>
				</ul>
				
				
				';
				
			}
			echo'<div class="header-cart-total">
			Total: '; echo $currency; echo number_format((float)$current_total, 2, '.', ',');
			echo' 
		</div>';
			?>
				<a style="float:right;" href="cart.php" class="btn btn-warning">Checkout&nbsp;&nbsp;<span class="glyphicon glyphicon-edit"></span></a>
			<?php
			exit();
		}
	}


	if (isset($_POST["getCartItem_mobile"])) {
		//display cart item in dropdown menu
		if (mysqli_num_rows($query) > 0) {
			$n=0;
			while ($row=mysqli_fetch_array($query)) {
				$n++;
				$product_id = $row["product_id"];
				$product_title = $row["product_title"];
				$product_price = $row["product_price"];
				$product_image = $row["product_image"];
				$cart_item_id = $row["id"];
				$qty = $row["qty"];

				//get total
				$current_total += $product_price * $qty;

				echo '
				<ul class="header-cart-wrapitem">
						<li class="header-cart-item">
							<div class="header-cart-item-img">
							<img src="'.$admin_no.'/assets/img/products/'.$product_image.'" alt="IMG" style="border-radius:5px;">
							</div>
							<div class="header-cart-item-txt">
							<a href="product_details.php?product='.$product_id.'" class="header-cart-item-name">
							'.$product_title.'
							</a>
							<span class="header-cart-item-info">'.$qty.' x 
							';echo $currency; echo number_format((float)$product_price, 2, '.', ','); echo'
							</span>
							</div>
						</li>
				</ul>
				
				
				';
				
			}
			echo'<div class="header-cart-total">
			Total: '; echo $currency; echo number_format((float)$current_total, 2, '.', ',');
			echo' 
		</div>';
			?>
				<a style="float:right;" href="cart.php" class="btn btn-warning">Checkout&nbsp;&nbsp;<span class="glyphicon glyphicon-edit"></span></a>
			<?php
			exit();
		}
	}

	if (isset($_POST["checkOutDetails"])) {
		if (mysqli_num_rows($query) > 0) {
			//display user cart item with "Ready to checkout" button if user is not login
			if(isset($_SESSION["user_id"])){
			$where_to = "order.php";
			}
			if(!isset($_SESSION["user_id"])){
			$where_to = "sign_in.php?redirect=cart.php";
			}
			echo "
			<div class='container'>
			<div class='row'>
			<div class='col-md-6'>
			<div class='billing'>
			<div class='checkout_title'>ITEMS IN CART</div>	<br/><br/><br/>	
			";
			
				$n=0;
				while ($row=mysqli_fetch_array($query)) {
					$n++;
					$product_id = $row["product_id"];
					$product_title = $row["product_title"];
					$product_price = $row["product_price"];
					$product_image = $row["product_image"];
					$cart_item_id = $row["id"];
					$qty = $row["qty"];
					$old_price = $row["old_price"];
					
					if(!$old_price == ""){
					$full_price = $product_price;
					$percent_off = $old_price;
					
					$percentInDecimal = $percent_off / 100;
					$percent = $percentInDecimal * $full_price;
					$discounted_price = $full_price - $percent;
					$product_price = $discounted_price;
					}

					echo"
					<img src='$admin_no/assets/img/products/$product_image' alt='' style='width:100px;height:100px;border-radius:5px;'><br/>
					$product_title
					<div class='small_gap'></div>
					";
							
					echo'<input style="display:none;border:none;font-weight:900;width:100px;height:20px;" type="text" class="price" value="'.$product_price.'" readonly="readonly">';
					
					echo'<b>'.$currency.'</b><input style="border:none;font-weight:900;width:100px;height:20px;" type="text" class="" value="'.number_format($product_price).'" readonly="readonly"><br/>';
							
					echo'
					<input style="border:1px solid lightgrey !important;width:110px;height:38.5px;border-radius:5px;padding:0 4px;" type="number" min="1" step="1" class="qty" value="'.$qty.'">
					
					'; 
					echo"
					<span class='reduce_button' style='position:relative;top:-1px;left:5px;'>
					<a title='Update Quantity' update_id='$product_id' class='site-btn update' style='margin-right:4px;color:white;background:hotpink;'>Update Qty</a>
					
					</span>
					<br/>
					";		
					echo'<input style="border:none;font-weight:900;opacity:0;" type="text" class="total" value="'.$product_price.'" readonly="readonly">
					<br/>
					';
							
					echo"	
					<span class='reduce_button'><a title='Remove from Cart' remove_id='$product_id' class='site-btn remove' style='position:relative;top:-13px;color:white;background:crimson;'>Remove</a></span>
					<br/><hr/>
					";
				$total = $qty * $product_price;
				$total_array[] = $total;
				}//end of while
										
				$grand_total = array_sum($total_array);
				$gt = $grand_total; ?>

			<script>
				function addDeliveryZone() {
  				var select_value = document.getElementById("delivery_zone").value;
					var result = select_value.split('-'); 
  				var delivery_fee = result[1];
					var formatted_delivery_fee = delivery_fee.toLocaleString("en-US");
					document.getElementById("shipping_fee").innerHTML = formatted_delivery_fee;

					var gt = parseInt(<?php echo $grand_total; ?>) + parseInt(delivery_fee);
					var formatted_gt = gt.toLocaleString("en-US");
  				document.getElementById("gt").innerHTML = formatted_gt;
				}
			</script>
				

			<?php	echo"	
				Subtotal<span class='number_box'>$currency";echo number_format($grand_total);echo"</span><br/>
				Shipping Fee<span class='number_box'>$currency";?><span id='shipping_fee'>0</span><?php echo"</span><hr/>
				Total <span class='number_box the_color'>$currency";?><span id='gt'><?php echo number_format($gt); ?></span><?php echo"
				</span></div><!-- end of billing --><br/><br/>
				 </div><!--End of col 6-->
				 ";?>
<?php 
//if they are signed in auto populate the fields
if(isset($_SESSION["user_id"])){
	
	$stmt_n = $con -> prepare('SELECT * FROM users WHERE user_id=?'); 
	$stmt_n -> bind_param('s',$user_id);
	$stmt_n -> execute(); 
	$stmt_n -> store_result(); 
	$stmt_n -> bind_result($id,$user_id,$first_name,$last_name,$email,$password,$phone,$address,$date_signed_up); 
	$numrows_n = $stmt_n -> num_rows();
	if($numrows_n > 0){
		$signed_in="Yes";
		while ($stmt_n -> fetch()) { }
	}
	else{$signed_in="No";}
}
else{
	$first_name="";$last_name="";
	$email="";$password="";
	$phone="";$address="";
}
?>			
<div class="col-lg-6">
<div class="billing">
<div class="checkout_title">billing details</div>
<?php if(!isset($_SESSION["user_id"])){ ?>
Have an account? Simply <a href='sign_in.php?u=cart'>sign in</a> and save time, otherwise simply fill your details below:
<?php } ?><br/>
<div class="">
<form action="order_enquiry.php" method='post'>

<div class="bo4 of-hidden size15 m-b-20">
<input class="sizefull s-text7 p-l-22 p-r-22" type="text" placeholder="First Name" required name='first_name' value='<?php echo $first_name; ?>' <?php if(isset($_SESSION["user_id"])){ ?> readonly <?php } ?>>
</div>

<div class="bo4 of-hidden size15 m-b-20">
<input type="text" class="sizefull s-text7 p-l-22 p-r-22" placeholder="Last Name" required name='last_name' value='<?php echo $last_name; ?>'<?php if(isset($_SESSION["user_id"])){ ?> readonly <?php } ?>>
</div>

<div class="bo4 of-hidden size15 m-b-20">
<input type="email" class="sizefull s-text7 p-l-22 p-r-22" placeholder="E-mail" name='email' required value='<?php echo $email; ?>'<?php if(isset($_SESSION["user_id"])){ ?> readonly <?php } ?>>
</div>

<!--<div class="bo4 of-hidden size15 m-b-20">
<input type="password" class="sizefull s-text7 p-l-22 p-r-22" placeholder="Password" name='password' value='<?php echo $password; ?>' required <?php if(isset($_SESSION["user_id"])){ ?> readonly <?php } ?>>
</div>-->

<div class="bo4 of-hidden size15 m-b-20">
<input type="text" class="sizefull s-text7 p-l-22 p-r-22" placeholder="Address" name='address' required value='<?php echo $address; ?>'>
</div>

<div class="bo4 of-hidden size15 m-b-20">
<input type="text" class="sizefull s-text7 p-l-22 p-r-22" placeholder="Phone" name='phone' value='<?php echo $phone; ?>' required>
</div>

<div class="bo4 of-hidden size15 m-b-20">
<select class="sizefull s-text7 p-l-22 p-r-22" name='payment_method' required>
	<option value=''>Please choose a payment method</option>
	<!--<option value='Pay on Delivery'>Pay on Delivery</option>-->
	<!--<option value='Online Payment'>Online Payment</option>-->
	<option value='Bank Transfer'>Bank Transfer</option>
</select>
</div>

<!--<a href="delivery_zones.php" target='_blank'>View Delivery Zones</a>-->
<div class="bo4 of-hidden size15 m-b-20">
<select class="sizefull s-text7 p-l-22 p-r-22" id="delivery_zone" onchange="addDeliveryZone()" name='delivery_zone' required>
<option value=''>Please choose a shipping option</option>
<?php 
			$stmt_de = $con -> prepare('SELECT * FROM delivery_zones'); 
			$stmt_de -> execute(); 
			$stmt_de -> store_result(); 
			$stmt_de -> bind_result($id_dz,$fee,$zone,$locations,$dis); 
			$numrows_de = $stmt_de -> num_rows();
			if($numrows_de > 0){
				while ($stmt_de -> fetch()) {
					echo"<option value='$id_dz-$fee'>$currency"; echo number_format((float)$fee, 2, '.', ','); echo " Zone $zone - $locations</option>";
			 }}
			?>
</select>
</div>

<div class="bo4 m-b-20">
<textarea name="comments" id="checkout_comment" class="sizefull s-text7 p-l-22 p-r-22" style='height:100px;' placeholder="Additional comments"></textarea>
</div>

<div class="w-size25">
	<!-- Button -->
	<button type='submit' name='place_order' class="flex-c-m size2 bg1 bo-rad-23 redbackground m-text3 trans-0-4">
		Place Order
	</button>
</div>

</form>
</div>
</div>
</div>
			
			
</div><!--End of Row-->
</div><!-- end of container -->
<?php

			}
	}
	
	
}

//Remove Item From cart
if (isset($_POST["removeItemFromCart"])) {
	$remove_id = $_POST["rid"];
	if (isset($_SESSION["user_id"])) {
		$sql = "DELETE FROM cart WHERE p_id = '$remove_id' AND ip_add = '$ip_add'";
	}else{
		$sql = "DELETE FROM cart WHERE p_id = '$remove_id' AND ip_add = '$ip_add'";
	}
	if(mysqli_query($con,$sql)){
		echo "
		<script>
			swal('Item', 'has been removed from your cart.', 'success');
		</script>
		";
		echo "<meta http-equiv=\"refresh\" content=\"0; url=cart.php\">";
		exit();
	}
}


//Update Item From cart
if (isset($_POST["updateCartItem"])) {
	$update_id = $_POST["update_id"];
	$qty = $_POST["qty"];
	if (isset($_SESSION["user_id"])) {
		$sql = "UPDATE cart SET qty='$qty' WHERE p_id = '$update_id' AND ip_add = '$ip_add'";
	}else{
		$sql = "UPDATE cart SET qty='$qty' WHERE p_id = '$update_id' AND ip_add = '$ip_add'";
	}
	if(mysqli_query($con,$sql)){
		echo "
		<script>
			swal('Item', 'has been updated.', 'success');
		</script>
		";
		echo "<meta http-equiv=\"refresh\" content=\"0; url=cart.php\">";
		exit();
	}
}
?>

Al-HUWAITI Shell