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


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/teachOficerEntry.php

<?php


function saveto($aobj_context)
{

	
	$type     = stripslashes($aobj_context->mobj_data["type"]);

	$college = $_SESSION['collcode'];
	$univcode = $_SESSION['FUNIVCODE'];

	if($college == '')
	{
		$data = 'Session Expired Login again and enter';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}
	
	if($univcode == '')
	{
		$data = 'Session Expired Login again and enter';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}

	if($type =='add')
	{

		$name    = stripslashes($aobj_context->mobj_data["name"]);
		$mob     = stripslashes($aobj_context->mobj_data["mob"]);
		$deggrp     = stripslashes($aobj_context->mobj_data["deggrp"]);
		$datefrom     = stripslashes($aobj_context->mobj_data["datefrom"]);
		$dateto     = stripslashes($aobj_context->mobj_data["dateto"]);
		$status     = stripslashes($aobj_context->mobj_data["status"]);
		// var_dump($datefrom);

		if($status = 'A'){
			$sts = 'F';
		}else{
			$sts = 'T';
		}

		$query = "select fdeggrp, fdescpn as fdescpn, fyear, fexamtype from deggrp 
		where fdeggrp = '{$deggrp}'";
		$res = $aobj_context->mobj_db->GetRow($query);
		$fyear = $res['fyear'];
		$fexamtype = $res['fexamtype'];

		$query = "SELECT * FROM logisys3_comexam.ansto WHERE fmobile = '{$mob}'";
		$res_mob = $aobj_context->mobj_db->GetRow($query);
		// var_dump($query);
		// var_dump($res_mob);

		if($res_mob == true){

			$data = "Updation failure.User already exist ";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;

			
		}

		$query = "INSERT INTO logisys3_comexam.ansto(funivcode,fcntrcode,fdeggrp,fyear,fexamtype,fmobile,fname,fcreadate,fdatefrom,fdateto,fsuspend)
		VALUES('{$univcode}','{$college}','{$deggrp}','{$fyear}','{$fexamtype}','{$mob}','{$name}',NOW(),
		DATE_FORMAT(STR_TO_DATE('{$datefrom}','%d/%m/%Y'),'%Y-%m-%d'),DATE_FORMAT(STR_TO_DATE('{$dateto}','%d/%m/%Y'),'%Y-%m-%d'),'{$sts}')";
		// var_dump($query);
		$studresults = $aobj_context->mobj_db->Execute($query);
		
		if($studresults)
		{
			$data = "Uploaded Successfully";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
		else
		{
			$data = "Updation failure. Please try after some time!";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;
		}

	}else if($type == 'edit')
	{
		
		$arr_edit    = stripslashes($aobj_context->mobj_data["arr_edit"]);
		$arry_arr_edit = json_decode($arr_edit);
		$arry_arr_edit = $arry_arr_edit[0];
		// var_dump($arry_arr_edit->name);
		// die();		

		
			if($arry_arr_edit->status == 'S')
			{
				$cnd = 'T';
			}else if($arry_arr_edit->status == 'A')
			{
				$cnd = 'F';
			}
			$query = "UPDATE logisys3_comexam.ansto SET 
			fname = '{$arry_arr_edit->name}', fmobile = '{$arry_arr_edit->mob}',fdeggrp = '{$arry_arr_edit->deggrp}',
			fdatefrom = DATE_FORMAT(STR_TO_DATE('{$arry_arr_edit->datefrom}','%d/%m/%Y'),'%Y-%m-%d'),
			fdateto = DATE_FORMAT(STR_TO_DATE('{$arry_arr_edit->dateto}','%d/%m/%Y'),'%Y-%m-%d'),
			fsuspend = '$cnd'
			WHERE fmobile = '{$arry_arr_edit->mob}'
			AND funivcode = '{$univcode}'";
			$studresults = $aobj_context->mobj_db->Execute($query);
			// var_dump($query);		
		
		if($studresults)
		{
			$data = "Uploaded Successfully";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
		else
		{
			$data = "Updation failure. Please try after some time!";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;
		}
	}

}

function getdeggrp($aobj_context)
{
	
	$select_qry = "select distinct fdeggrp, fdescpn as fdescpn, fyear, fexamtype
	FROM deggrp"; 

	$res = $aobj_context->mobj_db->GetAll($select_qry);

	echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
	return;
}


function ViewDeatilsto($aobj_context)
{
	
	$college = $_SESSION['collcode'];
	$univcode = $_SESSION['FUNIVCODE'];

	if($college == '')
	{
		$data = 'Session Expired Login again and enter';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}
	
	if($univcode == '')
	{
		$data = 'Session Expired Login again and enter';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}

	$select_qry = "select distinct funivcode,fcntrcode,fyear,fexamtype,fmobile,fname,fdeggrp,
	date_format(fcreadate,'%d/%m/%Y') as fcreadate, ifnull(fsuspend,'F') as fsuspend,
	ifnull(fdeleted,'F') as fdeleted, ifnull(fremarks,'F') as fremarks,date_format(fdatefrom,'%d/%m/%Y') as fdatefrom,
	date_format(fdateto,'%d/%m/%Y') as fdateto
	FROM logisys3_comexam.ansto where funivcode = '{$univcode}' and fcntrcode = '{$college}'"; 

	$res = $aobj_context->mobj_db->GetAll($select_qry);

	if($res)
	{
		$k=0;
	$sl_no=1;
	$str_reval.="<table align='center' id = 'toedit' class='tr_ventor_row' width='98%' border='0' cellspacing='0' cellpadding='5'>
	<tr class='tr_bg1'>
		<td align='center' style=' font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl. No.</td>
		<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Name</td>
		<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Mobile No</td>
		<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Date From</td>
		<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Date To</td>
		<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Action</td>
	</tr>
	<tbody>";	
    foreach($res as $ak=>$av)
    {
     
        $fname     = $av['fname'];
        $fmobile   = $av['fmobile'];
		$fcreadate = $av['fcreadate'];
		$fsuspend  = $av['fsuspend'];
		$fdeleted  = $av['fdeleted'];
		$fremarks  = $av['fremarks'];
		$fdatefrom  = $av['fdatefrom'];
		$fdateto  = $av['fdateto'];	
		$fdeggrp  = $av['fdeggrp'];
		
		$s = "";
		$a = "";
		$d = "";
		if($fsuspend =='T')
		{
			$value = 'S';
			$s = "selected";

		}else if($fdeleted == 'T')
		{
			$value = 'D';
			$d = "selected";
		}else
		{
			$value = 'A';
			$a = "selected";
		}
	
        if($k%2==0)
        $class='tbl_row1';
        else
        $class='tbl_row_alter1';

        $str_reval.="<tr>";		
        $str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >{$sl_no}</td>";
        $str_reval.="<td class='{$class}' style=' font-size:12px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >&nbsp;{$fname}</td>";
        $str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center;  ' >{$fmobile}&nbsp;</td>";
        $str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center;  ' >&nbsp;{$fdatefrom}</td>";
		$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >&nbsp;{$fdateto}</td>";
		$str_reval.="<td class='{$class}' style='font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center;' >
		<div>
		<button id='{$sl_no}_edit' onclick='edittechofficer($fmobile)' type='button'>Edit</button>&nbsp&nbsp
		<button id='{$sl_no}_delete' onclick='deletetechofficer($fmobile)' type='button' style='background: #ff4b4b;color: #fcfdfd;'>Delete</button>		
		</div>
		</td>";
        $str_reval.="</tr>";
        $sl_no++;
        $k++;
	}
	$str_reval.="</tbody></table>";
		
		$arr['table'] =  $str_reval;
		$arr['rowcnt'] =  $sl_no;				
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}else
	{
		$class='tbl_row1';

		$str_reval.="<table align='center' id = 'toedit' class='tr_ventor_row' width='98%' border='0' cellspacing='0' cellpadding='5'>
		<tr class='tr_bg1'>
			<td align='center' style=' font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl. No.</td>
			<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Name</td>
			<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Mobile No</td>
			<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Date From</td>
			<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Date To</td>
			<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Action</td>
		</tr>
		<tbody>";
		$str_reval.="<tr>";		
		$str_reval.="<td colspan='6' class='{$class}' style=' font-size:12px; text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >No details Found..!</td>
		</tr>";

		$arr['table'] =  $str_reval;
		$arr['data'] = "No Data Found";
		
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}
	
}

function deletetechofficer($aobj_context)
{
	
	$mob     = stripslashes($aobj_context->mobj_data["mob"]);
	// var_dump($mob);

	$select_qry = "DELETE FROM logisys3_comexam.ansto WHERE fmobile = '{$mob}'"; 
	$res = $aobj_context->mobj_db->Execute($select_qry);
	// var_dump($res);

	if($res)
		{
			$data = "Deleted Successfully";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
		else
		{
			$data = "Updation failure. Please try after some time!";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;
		}

}

function edittechofficer($aobj_context)
{
	
	$mob     = stripslashes($aobj_context->mobj_data["mob"]);
	// var_dump($mob);

	$select_qry = "SELECT DISTINCT funivcode,fcntrcode,fyear,fexamtype,fmobile,fname,fdeggrp,
	DATE_FORMAT(fcreadate,'%d/%m/%Y') AS fcreadate, IFNULL(fsuspend,'F') AS fsuspend,
	IFNULL(fdeleted,'F') AS fdeleted, IFNULL(fremarks,'F') AS fremarks,DATE_FORMAT(fdatefrom,'%d/%m/%Y') AS fdatefrom,
	DATE_FORMAT(fdateto,'%d/%m/%Y') AS fdateto
	FROM logisys3_comexam.ansto WHERE fmobile = '{$mob}'"; 
	$res = $aobj_context->mobj_db->GetRow($select_qry);
	// var_dump($res);

	if($res)
		{				
			echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
			return;
		}
		else
		{
			$data = "Data not found..!";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;
		}

}





?>