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


Current Path : /var/www/html/kswu/orms/src/
Upload File :
Current File : /var/www/html/kswu/orms/src/curricular.php

<?php

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

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

	$json = new Services_JSON();
	$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);
	
	$query = "delete from curricular
	where fuserid = {$userid} and fappno =  '{$appno}'";
	$result = $aobj_context->mobj_db->Execute($query);
	 
	$query1 = "insert into curricular(fuserid,fappno,FCURRICULAR, FCOCURRICULAR, FWORKSHOPS)
	values('{$userid}','{$appno}','{$persarr['1CA1']}', '{$persarr['1CA2']}', '{$persarr['1CA3']}')";
	//var_dump($query1);
	$results = $aobj_context->mobj_db->Execute($query1);
	
	
	if($results)
	{	
		$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 loadCurricularDetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	session_start();
	$userid = $_SESSION['userid'];
	$appno = stripslashes($aobj_context->mobj_data["appno"]);
	$query1 = "SELECT * FROM curricular 
	where fuserid = '{$userid}' and fappno = '{$appno}'";
	$result = $aobj_context->mobj_db->GetRow($query1);
	//var_dump($query1);
	$arr['curricular'] = $result;
	if($result)
	{	
		echo $aobj_context->mobj_output->ToJSONEnvelope($result,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;	
}

?>