<?php
include('session.php');
include('connection.php');

 $srno=$_POST['srno'];
 $head=$_POST['head'];
	$head1=$_POST['head1'];
	$info=mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $_POST['info']);
	$info1=$_POST['info1'];
	$dp1=$_POST['dp1'];
	$file2=$_POST['file2'];
	$path=$_POST['path'];

$dest2 = '';	         

if ($_FILES["file2"]["error"] > 0)
 {
                echo "Error: " . $_FILES["file2"]["error"] . "<br>";
                $error = 'File Contain Error';
 }
  else
  {
                        $temp1 = explode(".", $_FILES["file2"]["name"]);
                        $filename12 = substr(microtime(), 2, 7) . '.' . end($temp1);
                        $src1 = $_FILES["file2"]["tmp_name"];
                        $dest1 ="/var/www/prasad/zppalghar/pdfs/".$filename12;
                        $dest = "../pdfs/".$filename12;
                        file_put_contents($dest,file_get_contents($src1));
                        chmod($dest, 0777);
   }
$fname123=$dest;			        

$sql2="SELECT * from press_release";

$id=1;
$result11=mysqli_query($GLOBALS["___mysqli_ston"], $sql2) or die('Query Failed: ' . mysqli_error($GLOBALS["___mysqli_ston"]));
while($row1=mysqli_fetch_assoc($result11))
{		
$ss=$row1['srno'];
$id=$ss+1;

}

mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");
$res="UPDATE `press_release` SET `Header`='$head',`Header_marathi`='$head1',`News`='$info',`News_marathi`='$info1',`Date`='$dp1',`document1`='$fname123',`url`='$path',`LastModified`= NOW() WHERE `srno`='$srno'";


mysqli_query($GLOBALS["___mysqli_ston"], $res) or die ("Error Message5" . mysqli_error($GLOBALS["___mysqli_ston"]));
echo "<script>alert('Updated Successfully')
window.history.back();
</script>";
?>