<?php
ob_start();
session_start();
include_once('../connect.php');
if(!isset($_SESSION['username']))
{
header('location:login.php');
}
?>
<!DOCTYPE html>
<html>
<title>PCC</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<body>
<?php include_once("edit_menu.php"); ?>
<div class="container-fluid">
<p class="well">
<form action="" method="post" enctype="multipart/form-data">
<input type='file' name='file' multiple="" />
<input type='submit' name='submit' class="btn-info"/>
</form>
</p>
<h4 class="well" style='font-weight:bold;'>Upload Images (Image Count : 100)</h4>
<div class="row">
<?php
$images = glob("../rankings/*");
foreach($images as $img)
{
echo
'<div class="col-md-2">
<img src="'.$img.'" style="width:125px;height:150px">
<br>
<a class="btn-danger" href="gallery_editer.php">Delete</a>
</div>';
}
?>
</div>
</div>
<?php
//for upload
if(isset($_POST['submit']))
{
if($old_img != '')
{
$del_img = $old_img.'.jpeg';
unlink('images/'.$del_img);
}
move_uploaded_file($img_name,"images/".$img1.'.jpeg');
mysqli_query($db,"update gallery set image = '$img1' where id = '$pid'");
header("location:gallery_editer.php");
}
?>