| Server IP : 92.204.40.98 / Your IP : 216.73.216.201 Web Server : LiteSpeed System : Linux amster.dnsfors.com 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : tmksyste ( 2190) PHP Version : 8.3.31 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/tmksyste/public_html/TMAdmin/ |
Upload File : |
<?php include"header.php";?>
<?php include"sidebar.php";?>
<!-- ============================================================== -->
<!-- Start right Content here -->
<!-- ============================================================== -->
<div class="main-content">
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Add Gallery</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Gallery</a></li>
<li class="breadcrumb-item active">Add</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<!--end col-->
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs-custom rounded card-header-tabs border-bottom-0" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="tab" href="#personalDetails" role="tab" aria-selected="false">
<i class="fas fa-home"></i> Add Gallery Image
</a>
</li>
</ul>
</div>
<?php
$status = "OK"; //initial status
$msg="";
if(ISSET($_POST['save'])){
$slide_title = mysqli_real_escape_string($con,$_POST['slide_title']);
$desig= mysqli_real_escape_string($con,$_POST['desig']);
$uploads_dir = 'uploads/image_gallery';
$tmp_name = $_FILES["ufile"]["tmp_name"];
// basename() may prevent filesystem traversal attacks;
// further validation/sanitation of the filename may be appropriate
$name = basename($_FILES["ufile"]["name"]);
$random_digit=rand(0000,9999);
$new_file_name=$random_digit.$name;
move_uploaded_file($tmp_name, "$uploads_dir/$new_file_name");
if($status=="OK")
{
$qb=mysqli_query($con,"INSERT INTO image_gallery (image_title,ufile,desig) VALUES ('$slide_title','$new_file_name','$desig')");
header('location:image');
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=image">';
if($qb){
$errormsg= "
<div class='alert alert-success alert-dismissible alert-outline fade show'>
Image Gallery has been added successfully.
<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
</div>
"; //printing error if found in validation
}
}
elseif ($status!=="OK") {
$errormsg= "
<div class='alert alert-danger alert-dismissible alert-outline fade show'>
".$msg." <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button> </div>"; //printing error if found in validation
}
else{
$errormsg= "
<div class='alert alert-danger alert-dismissible alert-outline fade show'>
Some Technical Glitch Is There. Please Try Again Later Or Ask Admin For Help.
<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
</div>"; //printing error if found in validation
}
}
?>
<div class="card-body p-4">
<div class="tab-content">
<div class="tab-pane active" id="personalDetails" role="tabpanel">
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
print $errormsg;
}
?>
<form action="" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-lg-6">
<div class="mb-3">
<label for="firstnameInput" class="form-label"> Name</label>
<input type="text" class="form-control" id="firstnameInput" name="slide_title" placeholder="Enter Name">
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label for="firstnameInput" class="form-label">Photo</label>
<b>Image Size:352px*469px</b>
<input type="file" class="form-control" id="firstnameInput" name="ufile" accept="image/*">
</div>
</div>
<div class="col-lg-12">
<div class="hstack gap-2 justify-content-end">
<button type="submit" name="save" class="btn btn-primary">Add Gallery</button>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
</form>
</div>
<!--end tab-pane-->
<!--end tab-pane-->
<!--end tab-pane-->
</div>
</div>
</div>
</div>
<!--end col-->
</div>
</div>
<!-- container-fluid -->
</div>
<!-- End Page-content -->
<?php include"footer.php";?>