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.22.41.80


Current Path : /proc/thread-self/root/var/www/misc/public_html/ovms/src/
Upload File :
Current File : //proc/thread-self/root/var/www/misc/public_html/ovms/src/admpattern.php

<?php

function admeditpattern($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$patcode  = $aobj_context->mobj_data['id'];
	
	$query = "SELECT  patdetl.*, fpatcode AS patcode, fpatdesc AS patname FROM patdetl  
			 WHERE fpatcode = '{$patcode}'";
	$results = $aobj_context->mobj_db->GetAll($query);
	
	if($results)
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($results,0,"Success");
		return true;
	}
	else
	{
		$error_msg = ""; 
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Failure");
		return true;
	}
}

function admsavepattern($aobj_context)
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	include_once("/JSON.php");
	$json = new Services_JSON();
	$patcode = $aobj_context->mobj_data["patcode"];
	$patname = $aobj_context->mobj_data["patname"];
	$pattern_arr = stripslashes($aobj_context->mobj_data["pattern_arr"]);
	$mobj_jsondata = $json->decode($pattern_arr);
	$pattern_arr = get_object_vars($mobj_jsondata);
	
	$instqry = "";
	for($k=1;$k<=count($pattern_arr);$k++)
	{
		$instqry .= "('{$patcode}','{$patname}','{$pattern_arr[$k]->qnid}','{$pattern_arr[$k]->qnno}','{$pattern_arr[$k]->qntit}','{$pattern_arr[$k]->qndesc}','{$pattern_arr[$k]->maxmarks}','{$pattern_arr[$k]->mandqn}'),";
		
	}
	
	$query2 ="DELETE  FROM patdetl 
			 WHERE fpatcode = '{$patcode}'";
	$aobj_context->mobj_db->Execute($query2);	
	
	$query  = "insert into patdetl(fpatcode,fpatdesc,fqnid,fqnno,fqntit,fqndesc,fmaxmarks,fmandqn) values".$instqry;
	$query  = substr($query,0,strlen($query)-1);
	$rst	= $aobj_context->mobj_db->Execute($query);	

	if($rst)
	{
		$succ_msg = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($succ_msg,0,"Success");
		return true;
	}
	else
	{
		$error_msg = ""; 
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Failure");
		return true;
	}	
}

?>