Sindbad~EG File Manager
<!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'); ?>
<?php
include('dbconfig.php');
error_reporting( ~E_NOTICE );
require_once 'dbconfig.php';
if(isset($_POST['btnsave']))
{
$cat1 = $_POST['cf1'];
$cat2 = $_POST['cf2'];
// Configure upload directory and allowed file types
$upload_dir = 'uploads'.DIRECTORY_SEPARATOR;
$allowed_types = array('jpg', 'png', 'jpeg', 'gif');
// Define maxsize for files i.e 2MB
$maxsize = 2 * 1024 * 1024;
if(empty($cat1)){
$errMSG = "Please Enter Username.";
}
else if(empty($cat2)){
$errMSG = "Please Enter Your Job Work.";
}
// Checks if user sent an empty form
if(!empty(array_filter($_FILES['files']['name']))) {
// Loop through each file in files[] array
foreach ($_FILES['files']['tmp_name'] as $key => $value) {
$file_tmpname = $_FILES['files']['tmp_name'][$key];
$file_name = $_FILES['files']['name'][$key];
$file_size = $_FILES['files']['size'][$key];
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION);
// Set upload file path
$filepath = $upload_dir.$file_name;
// Check file type is allowed or not
if(in_array(strtolower($file_ext), $allowed_types)) {
// Verify file size - 2MB max
if ($file_size > $maxsize)
echo "Error: File size is larger than the allowed limit.";
// If file with name already exist then append time in
// front of name of the file to avoid overwriting of file
if(file_exists($filepath)) {
$filepath = $upload_dir.time().$file_name;
if( move_uploaded_file($file_tmpname, $filepath)) {
echo "{$file_name} successfully uploaded <br />";
}
else {
echo "Error uploading {$file_name} <br />";
}
}
else {
if( move_uploaded_file($file_tmpname, $filepath)) {
echo "{$file_name} successfully uploaded <br />";
}
else {
echo "Error uploading {$file_name} <br />";
}
}
}
else {
// If file extention not valid
echo "Error uploading {$file_name} ";
echo "({$file_ext} file type is not allowed)<br / >";
}
}
}
else {
// If no files selected
echo "No files selected.";
}
if(!isset($errMSG))
{
$stmt = $DB_con->prepare('INSERT INTO tbl_dyn_pg_mar(a1,a2) VALUES(:ca1, :ca2)');
$stmt->bindParam(':ca1',$cat1);
$stmt->bindParam(':ca2',$cat2);
if($stmt->execute())
{
?>
<script>
alert('Successfully Updated ...');
window.location.href='view_mar.php';
</script>
<?php
}
else
{
$errMSG = "error while inserting....";
}
}
}
?>
<section class="dbgs">
<div class="container py-4">
<h1 class="hs">Add News</h1>
<form method="post" enctype="multipart/form-data" class="form-horizontal">
<div class="form-group">
<input class="form-control" type="text" name="cf1" placeholder="News Title (*)" required/>
</div>
<div class="form-group">
<textarea rows="8" class="form-control" type="text" name="cf2" placeholder="News Link (*)" required/></textarea>
</div>
<button type="submit" name="btnsave" class=" btn-primary">save</button>
</form>
</div>
</section>
<?php
include('footer.php'); ?>
<script src="js/custom.js"></script>
</body>
</html>
<?php
include('footer.php'); ?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists