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

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_blog where blog_id='".$_REQUEST['id']."'");
$webres=mysqli_fetch_array($websel);
$image=$webres['image'];
}
$sql="update tbl_blog set
blog_category='".$_REQUEST['blog_category']."',
blog_title='".str_replace("'","^",$_REQUEST['blog_title'])."',
blog_by='".$_REQUEST['blog_by']."',
sort_description='".str_replace("'","^",$_REQUEST['sort_description'])."',
pg_url='".strtolower(str_replace(' ','-',$_REQUEST['pg_url']))."',
pg_meta_title='".str_replace("'","^",$_REQUEST['pg_meta_title'])."',
pg_meta_keyword='".str_replace("'","^",$_REQUEST['pg_meta_keyword'])."',
pg_meta_desc='".str_replace("'","^",$_REQUEST['pg_meta_desc'])."',
description='".str_replace("'","^",$_REQUEST['description'])."',
pg_status='".$_REQUEST['pg_status']."',
image='".$image."' where blog_id='".$_REQUEST['id']."'";
if(mysqli_query($conn,$sql))
{
$_SESSION['page-msg']="update Successfully";
?>
<script>window.location.href='manage-blog.php'</script>
<?php } ?>