<?php
session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}



$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
	
	date_default_timezone_set("Asia/Kolkata");
$mdate1= date('Y-m-d H:i:s');
$mdate= date('d-m-Y');
	$usermid = $_SESSION['umid'];
	include("connect.php");

	
	//$cmname=$_POST['cmname'];
	
	
	$imid1=$_POST['imid'];
	$pddid=$_POST['pddid'];
	$isdid=$_POST['isdid'];
	$companymid=$_POST['companymid'];
	$bankmid=$_POST['bankmid'];
	$paidamount=$_POST['paidamount'];
	$pfinalpayamount=$_POST['pfinalpayamount'];
	
	
	 $paydate=date("Y-m-d", strtotime($_POST['paydate']));
	
	$paymode=$_POST['paymode'];
	$payremark=$_POST['payremark'];
	
	
	$filename="";
	
	if(empty($_FILES['file2']['name']) == false  )
	{
		$simplephoto11=$_FILES['file2']['name'];
		$ext = pathinfo($simplephoto11, PATHINFO_EXTENSION);
		$fileexplode1 = explode(".",$simplephoto11);
		$fileend1 = end($fileexplode1);

		 $filename= date("YmdHis").rand(100,999).".".$fileend1;
		
		
		$path = "docs";
		move_uploaded_file( $_FILES['file2']['tmp_name'], $path ."/". $filename );
	}else{
		$_SESSION['msg1'] = "Upload Payment Receipt";
	
    header("Location: inquirydetail.php?id=$imid1&tab=student_payment");
	return;
	}
		
	
		$eve1 = "update res_payments_detail set  paydate='$paydate',paymode='$paymode',payremark='$payremark',companymid='$companymid',bankmid='$bankmid',pdupdatedon='$mdate1',pdupdatedby='$usermid',pdstatus='Recevied',pddocname='$filename',pfinalpayamount='$pfinalpayamount' where pddid=$pddid ";
		$re1 = mysqli_query($conn, $eve1);
		
		
			
		$_SESSION['msg'] = "Record Saved successfully";
	
   header("Location: inquirydetail.php?id=$imid1&tab=student_payment");
			
	
?>