<?php
error_reporting(0);
session_start();
include '../include/connection.php';
$conn     = db();
@extract($_REQUEST);
$folder='../upload/banner/';

if($_FILES['image']['name'])
{
$file=time().@str_replace(' ','-',$_FILES['image']['name']);
if(move_uploaded_file(@$_FILES['image']['tmp_name'],$folder.$file))
{
$image=$file;
}
}
else
{
$websel=mysqli_query($conn,"select * from tbl_gallery where gallery_id='".$_REQUEST['id']."'");
$webres=mysqli_fetch_array($websel);
$image=$webres['gallery_image'];
}
if($_FILES['logo_image']['name'])
{
$logo=time().@str_replace(' ','-',$_FILES['logo_image']['name']);
if(move_uploaded_file(@$_FILES['logo_image']['tmp_name'],$folder.$logo))
{
$logo_image=$logo;
}
}
else
{
$websel=mysqli_query($conn,"select * from tbl_gallery where gallery_id='".$_REQUEST['id']."'");
$webres=mysqli_fetch_array($websel);
$logo_image=$webres['logo_image'];
}
$sql="update tbl_gallery set
gallery_title='".$_REQUEST['gallery_title']."',
gallery_link='".$_REQUEST['gallery_link']."',
gallery_alt='".$_REQUEST['gallery_alt']."',
pg_status='".$_REQUEST['pg_status']."',
logo_image='".$logo_image."',
gallery_image='".$image."' where gallery_id=".$_REQUEST['id'];
if(mysqli_query($conn,$sql))
{
$_SESSION['banner-position-msg']="update Successfully";
?>
<script>window.location.href='add-gallery.php'</script>
<?php } ?>