|
Server IP : 2a02:4780:8:613:0:1a7d:6e18:10 / Your IP : 216.73.217.87 Web Server : LiteSpeed System : Linux nl-srv-web513.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64 User : u444427800 ( 444427800) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u444427800/domains/sahyogwelfarefoundation.com/public_html/admin/gallery/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include "connect.php";
if (empty($_SESSION['admin'])) {
?>
<script>
location.replace('./index.php')
</script>
<?php
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="icon" href="./Assets/Re-live Logo.png">
<title>Admin Panel</title>
</head>
<body>
<?php include("menu.php"); ?>
<!-- On tables -->
<div class="container">
<h2 class="text-center mt-3 mb-2">Media Gallery</h2>
<form action="" method="POST" class="mt-5" enctype="multipart/form-data">
<div class="row">
<div class="col-9 mb-3">
<label class="form-label">Upload Image</label>
<input type="file" name="gallery[]" class="form-control" multiple placeholder="Media Gallery" accept="image/*" required>
</div>
<div class="col-3 pt-2">
<button type="submit" name="btn_submit" class="btn btn-warning mt-4">Save Media Gallery</button>
</div>
</div>
</form>
<?php
$result = $conn->query("SELECT * FROM `gallery`");
$i = 1;
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) { ?>
<div class="d-inline-flex mb-5">
<div class="card" style="width:200px">
<!-- <div class="card-header"><?php //echo $row['gallery']
?></div> -->
<div class="card-body">
<a href="gallery_delete.php?gallery_id=<?php echo $row['gallery_id'] ?>" class="btn btn-sm btn-danger position-absolute">Delete</a>
<img src="<?php echo $row['gallery'] ?>" class="img-fluid img-thumbnail">
</div>
</div>
</div>
<?php
$i++;
}
} else { ?>
<img src="./Assets/noData.jpg" alt="" style="width: 300px;" class="img-fluid img-thumbnail">
<?php
}
?>
</div>
<?php
if (isset($_POST["btn_submit"])) {
foreach ($_FILES['gallery']['tmp_name'] as $key => $tmp_name) {
$imagePath = "gallery/";
$uniquesavename = time() . uniqid(rand());
$image_type = basename($_FILES["gallery"]["name"][$key]);
$gallery = $imagePath.$uniquesavename . '.' . $image_type;
$filename = $_FILES["gallery"]["tmp_name"][$key];
move_uploaded_file($filename, $gallery);
$result = $conn->query("INSERT INTO `gallery`(`gallery`) VALUES ('$gallery')");
}
?>
<script>
location.href = "gallery.php";
</script>
<?php
} ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</body>
</html>