<?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'];
	$isdid=$_POST['isdid'];
	
	$paidamount=$_POST['paidamount'];
	$paycurrency=$_POST['paycurrency'];
	$paycurrencyvalue=$_POST['paycurrencyvalue'];
	
	
	$paypendingamt1=$_POST['paypendingamt1'];
	
	
		
	if($paidamount<=$paypendingamt1)
	{
		$eve1 = "INSERT INTO res_payments_detail (imid,isdid, paidamount,pdaddedon,pdaddedby,pdupdatedon,pdupdatedby,paycurrency,paycurrencyvalue) VALUES('$imid1','$isdid','$paidamount','$mdate1','$usermid','$mdate1','$usermid','$paycurrency','$paycurrencyvalue')";
		$re1 = mysqli_query($conn, $eve1);
		
		
			
		$_SESSION['msg'] = "Record Saved successfully";
	}
	else
	{
		$_SESSION['msg1'] = "Your Pending amount is only $paypendingamt1";
	}
    header("Location: inquirydetail.php?id=$imid1&tab=student_payment");
			
	
?>