Sindbad~EG File Manager

Current Path : /home/u625735752/domains/feednationngo.org/public_html/admin/
Upload File :
Current File : /home/u625735752/domains/feednationngo.org/public_html/admin/edit_sld.php

<?php
 error_reporting( ~E_NOTICE );
 require_once 'dbconfig.php';
 
 if(isset($_GET['edit_id']) && !empty($_GET['edit_id']))
 {
  $id = $_GET['edit_id'];
  $stmt_edit = $DB_con->prepare('SELECT a1,aimg FROM tbl_dyn_pg_sld WHERE userID =:uid');
  $stmt_edit->execute(array(':uid'=>$id));
  $edit_row = $stmt_edit->fetch(PDO::FETCH_ASSOC);
  extract($edit_row);
 }
 else
 {
  header("Location: index.php");
 }
 
 if(isset($_POST['btn_save_updates']))
 {
  $cat1 = $_POST['cf1'];// user name
   
  $imgFile = $_FILES['user_image']['name'];
  $tmp_dir = $_FILES['user_image']['tmp_name'];
  $imgSize = $_FILES['user_image']['size'];
     
  if($imgFile)
  {
   $upload_dir = '../dyn/sld//'; // upload directory 
   $imgExt = strtolower(pathinfo($imgFile,PATHINFO_EXTENSION)); // get image extension
   $valid_extensions = array('jpeg', 'jpg', 'png', 'gif'); // valid extensions
   $catpic = rand(1000,1000000).".".$imgExt;
   if(in_array($imgExt, $valid_extensions))
   {   
    if($imgSize < 5000000)
    {
     unlink($upload_dir.$edit_row['aimg']);
     move_uploaded_file($tmp_dir,$upload_dir.$catpic);
    }
    else
    {
     $errMSG = "Sorry, your file is too large it should be less then 5MB";
    }
   }
   else
   {
    $errMSG = "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";  
   } 
  }
  else
  {
   // if no image selected the old image remain as it is.
   $catpic = $edit_row['aimg']; // old image from database
  } 
      
  
  // if no error occured, continue ....
  if(!isset($errMSG))
  {
   $stmt = $DB_con->prepare('UPDATE tbl_dyn_pg_sld 
              SET a1=:ca1, 
               aimg=:cpic 
               WHERE userID=:uid');
   $stmt->bindParam(':ca1',$cat1);
   $stmt->bindParam(':cpic',$catpic);
   $stmt->bindParam(':uid',$id);
    
   if($stmt->execute()){
    ?>
                <script>
    alert('Successfully Updated ...');
    window.location.href='view_sld.php';
    </script>
                <?php
   }
   else{
    $errMSG = "Sorry Data Could Not Updated !";
   }
  }    
 }
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Admin Area</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta content=" " name="title">
  <meta content=" " name="description">
  <meta property="og:image" content="http:// .com/img/ss.jpg">
  <link href="img/apple-touch-icon.png" rel="apple-touch-icon">
  <link rel="icon" href="img/favicon.ico" type="image/ico" sizes="16x16">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  <link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;600&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <link href="css/custom.css" rel="stylesheet">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
  <script src="js/custom.js"></script>
</head>
<body>


<div id="preloader">
	<div id="status">
		<img src="img/logo1.png" id="preloader_image" alt="loader"/>
	</div>
</div>
<?php
 include('nav.php'); ?>
<?php
 include('ini.php'); ?>
 
 
 
 
	
	

<section class="dbgs">
	<div class="container py-4">
		<h1 class="hs">Edit Image</h1>	
			
		<form method="post" enctype="multipart/form-data" class="form-horizontal">
		   
			
			<div class="row">		 
			
				<div class="form-group   col-md-6">
					<input class="form-control" type="text" name="cf1"   value="<?php echo $a1;?>"  maxlength="100"  />
				</div>
				<div class="form-group col-md-6">
					  <input class="input-group form-control" type="file" name="user_image" accept="image/*" />
			<label>Image Dimension : 960px*430px </label>
				</div>
			</div>
			
			
				<button type="submit" name="btn_save_updates" class=" btn-primary"> save</button>
				
		</form>

	</div>
</section>


<?php
 include('footer.php'); ?>
  <script src="js/custom.js"></script>
</body>
</html>



Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists