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


Current Path : /var/www/html/cuk/orms_wait/src_old/
Upload File :
Current File : //var/www/html/cuk/orms_wait/src_old/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'];
	$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"]);
	$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}";
	$rstD=$aobj_context->mobj_db->Execute($queryD);
	 
	$query1 = "insert into perdetl(fuserid, 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}', '{$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']}')";

	$rst1 = $aobj_context->mobj_db->Execute($query1);
	$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,fspoken,fwritten) 
		values({$userid},'{$foreign_arr[$k]->spoken}','{$foreign_arr[$k]->written}')";
		$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'];
	
	$query1 = "SELECT * FROM perdetl 
	where fuserid = '{$userid}'";
	$result1 = $aobj_context->mobj_db->GetAll($query1);
	
	$query2 = "SELECT * FROM languagedetl 
	where fuserid = '{$userid}'";
	$result2 = $aobj_context->mobj_db->GetAll($query2);
	
	$arr['perdet'] = $result1;
	$arr['langdet'] = $result2;
	if($result1 && $result2)
	{	
		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;	
}

?>