
<?php
include ('session.php');
include('test.php');
include('connection.php');
header( 'Content-Type: text/html; charset=utf8_unicode_ui' );
$srno=test_input($_POST['srno']);
$dis=test_input($_POST['head']);
$dis_mar=test_input($_POST['head1']);
//echo $dis_mar;
$dp1=$_POST['dp1'];
$file2= $_FILES['file2']['name'];

 
if ($_FILES["file2"]["error"] > 0)
 {
                echo "Error: " . $_FILES["file2"]["error"] . "<br>";
                $error = 'File Contain Error';
 }
  else
  {
                        $temp1 = explode(".", $_FILES["file2"]["name"]);
                        $filename1 = round(microtime(true)) . '.' . end($temp1);
                        $src1 = $_FILES["file2"]["tmp_name"];
                        $dest1 ="/var/www/prasad/zppalghar/pdfs/".$filename1;
                        $dest = "pdfs/".$filename1;
                        file_put_contents($dest1,file_get_contents($src1));
                        chmod($dest1, 0777);
   }
$fname1=$dest;
  
mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");
//$sql="INSERT INTO `employee_of_the_week`(dis,dis_mar,dp1,file2) VALUES ('$dis','$dis_mar',NOW(),'$fname1')";	
$sql="UPDATE `employee_of_the_week` SET `dis`='$dis',`dis_mar`='$dis_mar' WHERE `srno`='$srno'";	
//echo $sql;
//mysql_query("SET NAMES utf8_unicode_ci");
$res=mysqli_query($GLOBALS["___mysqli_ston"], $sql) or die("Error message". mysqli_errno($GLOBALS["___mysqli_ston"]));
echo '<script>
alert("Documents Updated..!!!");
window.location.href="updation_emp.php"</script>';

?>
