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


Current Path : /var/www/html/cuk/orms_wait/admin/src/
Upload File :
Current File : //var/www/html/cuk/orms_wait/admin/src/personaldet.php

<?php

function replaceChars($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}

function savepersonaldetails($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$appno = $_SESSION['appno'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	include_once("/JSON.php");
	

	$json = new Services_JSON();
	$fqualify = stripslashes($aobj_context->mobj_data["fqualify"]);
	$fcatcode = stripslashes($aobj_context->mobj_data["fcatcode"]);
	$appno = stripslashes($aobj_context->mobj_data["appno"]);
	$fieldarrvalue = stripslashes($aobj_context->mobj_data["fieldarrvalue"]);
	$persnaldet = $json->decode($fieldarrvalue);
	$persarr = get_object_vars($persnaldet);
	
	$foreign_arr = stripslashes($aobj_context->mobj_data["foreign_arr"]);
	$mobj_jsondata = $json->decode($foreign_arr);
	$foreign_arr = get_object_vars($mobj_jsondata);
	
	/* $queryD = "delete from perdetl
	where fuserid = '{$userid}' and fappno = '{$appno}'";
	$rstD=$aobj_context->mobj_db->Execute($queryD);
	/*   */
	/* $query1 = "insert into perdetl(fuserid,fappno,fname, fdob, fage, fbirthplace, ffatname, fmotname, freligion, fnational, fgender, fcatcode
	,fmarstatus, fph, fphtype, fphper, fcomadd1, fcomadd2, fcomadd3, fcomadd4, fperadd1, fperadd2, fperadd3, fperadd4, femailid
	,fphone, fmobile)
	values('{$userid}','{$appno}','{$persarr['T1']}', DATE_FORMAT(str_to_date('{$persarr['T2']}','%d/%m/%Y'),'%Y-%m-%d'), '{$persarr['T3']}', '{$persarr['T4']}', '{$persarr['T5']}'
	, '{$persarr['T6']}', '{$persarr['T7']}', '{$persarr['T8']}', '{$persarr['T9']}', '{$fcatcode}', '{$persarr['T11']}'
	, '{$fqualify}', '{$persarr['T14']}', '{$persarr['T15']}', '{$persarr['T16']}', '{$persarr['T17']}'
	, '{$persarr['T18']}', '{$persarr['T19']}', '{$persarr['T20']}', '{$persarr['T21']}', '{$persarr['T22']}', '{$persarr['T23']}'
	, '{$persarr['T24']}', '{$persarr['T25']}', '{$persarr['T26']}')"; */
	//var_dump($query1); */
	
	$query = "update perdetl set fname = '{$persarr['T1']}',fdob = DATE_FORMAT(str_to_date('{$persarr['T2']}','%d/%m/%Y'),'%Y-%m-%d'),
		fage = '{$persarr['T3']}',
		fbirthplace =  '{$persarr['T4']}',
		ffatname    =  '{$persarr['T5']}',	
		fmotname    =  '{$persarr['T6']}',
		freligion   =  '{$persarr['T7']}',
		fnational   =  '{$persarr['T8']}',
		fgender     =  '{$persarr['T9']}',
		fcatcode    =  '{$fcatcode}',
		fmarstatus  =  '{$persarr['T11']}',
		fph         =  '{$fqualify}',
		fphtype     =  '{$persarr['T14']}',
		fphper      =  '{$persarr['T15']}',
		fcomadd1    =  '{$persarr['T16']}',
		fcomadd2    =  '{$persarr['T17']}',
		fcomadd3    =  '{$persarr['T18']}',
		fcomadd4    =  '{$persarr['T19']}',
		fperadd1    =  '{$persarr['T20']}',
		fperadd2    =  '{$persarr['T21']}',
		fperadd3    =  '{$persarr['T22']}',
		fperadd4    =  '{$persarr['T23']}',
		femailid    =  '{$persarr['T24']}',
		faadhar    =  '{$persarr['T90']}',
		fphone      =  '{$persarr['T25']}',
		fmobile     =  '{$persarr['T26']}'
		where fuserid = '{$userid}' ";
	$rst1 = $aobj_context->mobj_db->Execute($query);
	$queryD = "delete from languagedetl
	where fuserid = {$userid} ";
	$rstD=$aobj_context->mobj_db->Execute($queryD);	
		
	for($k=1;$k<=count($foreign_arr);$k++)
	{
		$query2 = "insert into languagedetl(fuserid,fappno,flanguage,fread,fwrite,fspoken) 
		values('{$userid}','{$appno}','{$foreign_arr[$k]->language}','{$foreign_arr[$k]->read}','{$foreign_arr[$k]->write}','{$foreign_arr[$k]->spoken}')";
		$rst2=$aobj_context->mobj_db->Execute($query2);	
	}
	
	if($rst1 || $rst2 )
	{	
		$arr = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}	
	else
	{	
		$arr = "Some Failure as occured";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error"); 
	}
}

function loadPersonalDetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	session_start();
	//$userid = $_SESSION['userid'];

	$query3 = "SELECT distinct fdegree AS internal_code, fdescpn AS value from mascourse
		where (ifnull(fassistant,'') = 'T' || ifnull(fassociate,'') = 'T' || ifnull(fprofessor,'') = 'T')";
		$result3=$aobj_context->mobj_db->GetAll($query3);
	
	$arr['subject'] = $result3;
	if($result3)
	{	
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}	
	else
	{	
		$arr = "Some Failure as occured";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error"); 
	}	
}

function saveUserSelectedPhoto($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid']; 

	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	
	$file_name=replaceChars(basename($_FILES['student_photo_upload']['name']));
	$path_arr=pathinfo($_FILES['student_photo_upload']['name']);
	$file_ext=$path_arr['extension'];

	$temp_path=$aobj_context->main_src."/student_photos/".$userid;
	if(!file_exists($temp_path))
	{
		mkdir($temp_path);
	}
	$file_path="/{$userid}_photo.{$file_ext}";
 	$temp_path.=$file_path;
	if(isset($_FILES['student_photo_upload']['name']) && $_FILES['student_photo_upload']['name'] != '')         
	{ 
		$size=($_FILES['student_photo_upload']['size']/1024);
		if($size>1024)
		{
			$data="Please Upload the Photo of size less than 1 MB";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
			return;
		}
		if(move_uploaded_file($_FILES['student_photo_upload']['tmp_name'],$temp_path))
		{
			$data="student_photos/{$userid}/{$file_path}";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
	}
	$data="sucess";
	echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
	return;	
}

function saveUserSelectedSign($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid']; 

	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	
	$file_name=replaceChars(basename($_FILES['student_sign_upload']['name']));
	$path_arr=pathinfo($_FILES['student_sign_upload']['name']);
	$file_ext=$path_arr['extension'];

	$temp_path=$aobj_context->main_src."/student_photos/".$userid;
	if(!file_exists($temp_path))
	{
		mkdir($temp_path);
	}
	$file_path="/{$userid}_sign.{$file_ext}";
 	$temp_path.=$file_path;
	if(isset($_FILES['student_sign_upload']['name']) && $_FILES['student_sign_upload']['name'] != '')         
	{ 
		$size=($_FILES['student_sign_upload']['size']/1024);
		if($size>1024)
		{
			$data="Please Upload the Photo of size less than 1 MB";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
			return;
		}
		if(move_uploaded_file($_FILES['student_sign_upload']['tmp_name'],$temp_path))
		{
			$data="student_photos/{$userid}/{$file_path}";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
	}
	$data="sucess";
	echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
	return;	
}

?>