<?php
 session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}
	
	include("connect.php");
	include("mylibrary.php");
	date_default_timezone_set("Asia/Kolkata");
	$mdate= date('Y-m-d H:i:s');
	
	$umid = $_SESSION['umid'];
	
	
	
	$dmdmid=$_POST['dmdmid'];
	$dmfilename='';;
	if(empty($_FILES['dmfilename']['name']) == false  )
	{
		$filename=checkvalidstring($_FILES['dmfilename']['name']);
		$filename = str_replace(' ', '', $filename);
		$dmfilename = date("YmdHis").$filename;
		$path = "docs/";
		move_uploaded_file( $_FILES['dmfilename']['tmp_name'], $path ."/". $dmfilename );
		$eve2 = "update res_dmdesign_master set  submittedon='$mdate',submittedby='$umid',dmfilename='$dmfilename' where dmdmid=$dmdmid ";
	
	
	if ($conn->query($eve2) === TRUE)
	{
		$last_id = $conn->insert_id;
		
		
		
		
		$_SESSION['msg'] = "Record has been updated successfully";
	}
	else
	{
		$_SESSION['msg1'] = "Error";
	}
	
	
	}else{
		$_SESSION['msg1'] = "Please Uploade Image";
	}
	
	
	
	
	
		header("Location: dmdesign.php");
	
?>	