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

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 subcontent_tbl where subcontent_id='".$_REQUEST['id']."'");
$webres=mysqli_fetch_array($websel);
$image=$webres['image'];
}
$cat=$_REQUEST['cat'];
// echo $cat;
$subcat=$_REQUEST['subcat'];
$subsubcat=$_REQUEST['subsubcat'];
$all_cat=implode("^",$cat);
$all_subcat=implode("^",$subcat);
$all_finalcat=implode("^",$subsubcat);
$sql="update subcontent_tbl set subcontent_cat='".$all_cat."', subcontent_subcat='".$all_subcat."', product_subsubcat='$all_finalcat', subcontent_metatitle='".$_REQUEST['metatitle']."', subcontent_metadesc='".$_REQUEST['metadesc']."', subcontent_mrtakey='".$_REQUEST['metakey']."', subcontent_desc='".$_REQUEST['description']."', pg_status='".$_REQUEST['pg_status']."', image='".$image."',  subcontent_date= now() where subcontent_id='".$_REQUEST['id']."'";
// echo "update subcontent_tbl set subcontent_cat='".$all_cat."', subcontent_subcat='".$all_subcat."', product_subsubcat='$all_finalcat', subcontent_metatitle='".$_REQUEST['metatitle']."', subcontent_metadesc='".$_REQUEST['metadesc']."', subcontent_mrtakey='".$_REQUEST['metakey']."', subcontent_desc='".$_REQUEST['description']."', pg_status='".$_REQUEST['pg_status']."', image='".$image."',  subcontent_date= now() where subcontent_id='".$_REQUEST['id']."'";
if(mysqli_query($conn,$sql))
{
// echo "kabir";
$_SESSION['page-msg']="update Successfully";
?>
<script>window.location.href='manage-subdomain.php'</script>
<?php } ?>