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


Current Path : /proc/thread-self/root/var/www/html/phdadm/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/phdadm/src/saveApplication.php

<?php
include_once("/JSON.php");	
$json = new Services_JSON();
function saveDetails($aobj_context)
{
	//trans 
	//
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$json = new Services_JSON();
	//var_dump($aobj_context->mobj_data);
	$studname = trim($aobj_context->mobj_data["studname"]);
	$fatname = trim($aobj_context->mobj_data["fatname"]);
	$motname = trim($aobj_context->mobj_data["motname"]);
	$category = trim($aobj_context->mobj_data["category"]);
	$religion = trim($aobj_context->mobj_data["religion"]);
	$caste = trim($aobj_context->mobj_data["caste"]);
	$gender = trim($aobj_context->mobj_data["gender"]);
	$handicap = trim($aobj_context->mobj_data["handicap"]);
	$nationality = trim($aobj_context->mobj_data["nationality"]);
	$dob = trim($aobj_context->mobj_data["dob"]);
	$adhar = trim($aobj_context->mobj_data["adhar"]);
	$padd1 = trim($aobj_context->mobj_data["padd1"]);
	$padd2 = trim($aobj_context->mobj_data["padd2"]);
	$padd3 = trim($aobj_context->mobj_data["padd3"]);
	$pdistrict = trim($aobj_context->mobj_data["pdistrict"]);
	$ppincode = trim($aobj_context->mobj_data["ppincode"]);
	$pstate = trim($aobj_context->mobj_data["pstate"]);
	$cadd1 = trim($aobj_context->mobj_data["cadd1"]);
	$cadd2 = trim($aobj_context->mobj_data["cadd2"]);
	$cadd3 = trim($aobj_context->mobj_data["cadd3"]);
	$cpincode = trim($aobj_context->mobj_data["cpincode"]);
	$mobile = trim($aobj_context->mobj_data["mobile"]);
	$accnumber = trim($aobj_context->mobj_data["accnumber"]);
	$branch = trim($aobj_context->mobj_data["branch"]);
	$ifsc = trim($aobj_context->mobj_data["ifsc"]);
	$landline = trim($aobj_context->mobj_data["landline"]);
	$email = trim($aobj_context->mobj_data["email"]);
	$ocupation = trim($aobj_context->mobj_data["ocupation"]);
	$income = trim($aobj_context->mobj_data["income"]);
	$graduation = trim($aobj_context->mobj_data["graduation"]);
	$degree = trim($aobj_context->mobj_data["degree"]);
	$subject = trim($aobj_context->mobj_data["subject"]);
	$moi = trim($aobj_context->mobj_data["moi"]);
	$suboption = trim($aobj_context->mobj_data["suboption"]);
	$cstate = trim($aobj_context->mobj_data["cstate"]);
	$cdistrict = trim($aobj_context->mobj_data["cdistrict"]);
	$centercode = trim($aobj_context->mobj_data["centercode"]);
	$qaldeg = trim($aobj_context->mobj_data["qaldeg"]);
	$qalreg = trim($aobj_context->mobj_data["qalreg"]);
	$qalsub         = trim($aobj_context->mobj_data["qalsub"]);
	$qalpassyear    = trim($aobj_context->mobj_data["qalpassyear"]);
	$qalinstitut    = trim($aobj_context->mobj_data["qalinstitut"]);
	$paymenttype    = trim($aobj_context->mobj_data["paymenttype"]);
	$qaloption      = trim($aobj_context->mobj_data["qaloption"]);
	$totfee         = trim($aobj_context->mobj_data["totfee"]);
	$sign_filename  = trim($aobj_context->mobj_data["sign_filename"]);
	$photo_filename = trim($aobj_context->mobj_data["photo_filename"]);
	$lateral        = trim($aobj_context->mobj_data["lateral"]);
	$fpassuniv      = trim($aobj_context->mobj_data["fpassuniv"]);
	$year      		= trim($aobj_context->mobj_data["year"]);
	//var_dump($subject);
	$examno = "A";
	if($year != '')
		$examno = $year;
	$f_year = '2018';

	/*$qry = "select fadmto from collexam where fdegree = '{$degree}' and fcollcode = '{$centercode}' 
			and fexamno = 'A'
			and DATE_FORMAT(NOW(),'%Y-%m-%d') 
			BETWEEN DATE_FORMAT(fadmfrom,'%Y-%m-%d') 
			AND DATE_FORMAT(fadmto,'%Y-%m-%d')";
			//var_dump($qry);
	$student_exam_details = $aobj_context->mobj_db->GetRow($qry);

	$fadmto = $student_exam_details['fadmto'];	
	if(count($student_exam_details) <= 0)
	{
		$arr['message']='Last date for student admission is over';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;		
	}*/

	$query2 = "select right(concat('0000',ifnull(max(FSLNO),0)+01),4) 
				as  FSLNO from studadm
			where  FDEGREE='{$degree}' and FCOLLCODE='{$centercode}'";
	$rst2 = $aobj_context->mobj_db->getRow($query2);

	$slnocnt = $rst2['FSLNO'];
	$app_no = $degree.$centercode.$slnocnt;
	
	//var_dump($query2);
	$insert_query = "insert into studadm 
					(FSLNO, FEXAMNO, FNAME, FFATNAME, FMOTNAME,
						FFAT_OCC, FCASTE, FSUBCASTE, FRELIGION, FSEX, 
						FHANDICAP,FNATIONAL, FDOB, FAADHARNO,
						FCURRADD1, FCURRADD2,FCURRADD3, FCURDISTRICT,
						FCURSTATE, FCURPINCODE, 
						FPERMADD1, FPERMADD2,FPERMADD3, FPERDISTRICT,
						FPERSTATE, FPERPINCODE,
						FCONTACT_NO, FLANDLINE, FEMAIL,
						FINCOME, FBANKACNO, FBANKBRANCH, FIFSCCODE,
						FDEGREE, FENGLISH,  
						FCOMBCODE, FBASICQAL,  
						FCOLLCODE, FPREVREGNO,
 						FPREVCOMB, FPREVELECTIVE, FPASSMTHYEAR,
 						FPREVCOLLEGE, FPAYMENTTYPE, FAPPNO, FTOTFEE,
 						FAPPLASTDATE, FCREATEDATE, FCREATEUSER, FLATERAL_ENTRY) 
			values('{$slnocnt}', '{$examno}','{$studname}', 
					'{$fatname}', '{$motname}', '{$ocupation}',
					'{$category}', '{$caste}', '{$religion}', '{$gender}', '{$handicap}', 
					'{$nationality}',date_format(str_to_date('{$dob}','%d/%m/%Y'),'%Y-%m-%d'), 
					'{$adhar}', '{$cadd1}',
					'{$cadd2}', '{$cadd3}', '{$cdistrict}', '{$cstate}',
					'{$cpincode}', '{$padd1}',
					'{$padd2}', '{$padd3}', '{$pdistrict}', '{$pstate}',
					'{$ppincode}', '{$mobile}', '{$landline}', 
					'{$email}', '{$income}', '{$accnumber}', '{$branch}', '{$ifsc}',
					'{$degree}', '{$moi}', '{$subject}', '{$qaldeg}',
					'{$centercode}', 
					'{$qalreg}', '{$qalsub}', '{$qaloption}',
					'{$qalpassyear}','{$fpassuniv}','{$paymenttype}',
					'{$app_no}','{$totfee}','{$fadmto}', NOW(),'{$studname}','{$lateral}')";
	//var_dump($insert_query);
	$lobj_rs = $aobj_context->mobj_db->Execute($insert_query);
	
	$college_path=$aobj_context->main_src."student_photos/{$centercode}";
	$degree_path=$aobj_context->main_src."student_photos/{$centercode}/".$degree;;
	$folder_path=$aobj_context->main_src."student_photos/{$centercode}/".$degree;;
	$sign_folder_path = $aobj_context->main_src."student_photos/{$centercode}/".$degree."/sign";;
	
	$image_path = $aobj_context->main_src."upload/{$photo_filename}";

	$filename = explode(".", $photo_filename);
	$ext = strtolower($filename[1]);
	$photo_filename = $centercode."_".$degree."_".$app_no;
	$photo_filename = $photo_filename.".".$ext;

	$full_file_path = $folder_path.'/'.$photo_filename;

	if(!file_exists($college_path))
	{
		mkdir($college_path);
	}

	if(!file_exists($degree_path))
	{
		mkdir($degree_path);
	}
	if(!file_exists($sign_folder_path))
	{
		mkdir($sign_folder_path);
	}

	$photo = "student_photos/{$centercode}/".$degree.'/'.$photo_filename;
	

	if(copy($image_path,$full_file_path))
	{
		$update="update studadm set FPHOTOPATH='{$photo}' 
				where FAPPNO=  '{$app_no}' ";
		//var_dump($update);
		$up_obj=$aobj_context->mobj_db->Execute($update); 
		unlink($image_path);
	}

	//update signature path

	$sign_path = $aobj_context->main_src."upload/{$sign_filename}";

	$filename = explode(".", $sign_filename);
	$ext = strtolower($filename[1]);
	$sign_filename = $centercode."_".$degree."_".$app_no."_sign";
	$sign_filename = $sign_filename.".".$ext;

	$full_file_path_sign = $folder_path."/sign/".$sign_filename;

	$sign = "student_photos/{$centercode}/".$degree."/sign/".$sign_filename;

	if(copy($sign_path,$full_file_path_sign))
	{
		$update="update studadm set FSIGNPATH='{$sign}' 
				where FAPPNO=  '{$app_no}' ";
		$up_obj=$aobj_context->mobj_db->Execute($update); 
		unlink($sign_path);
	}

	$options_insert =  "insert into options 
		select  '{$degree}','{$examno}','{$centercode}', '{$slnocnt}',
		 fsubcode, 'F', '{$f_year}', '{$app_no}','' 
		from mascomb where  fdegree = '{$degree}' 
		and fcombcode = '{$subject}'";
	//var_dump($options_insert);
	$up_obj=$aobj_context->mobj_db->Execute($options_insert);

	$options_insert = "insert into options(FDEGREE, FEXAMNO, 
		FCOLLCODE, FSLNO, FSUBCODE,
		 FDELETED, FYEAR, FAPPNO) 
		 values('{$degree}','{$examno}','{$centercode}', '{$slnocnt}',
		 '{$suboption}', 'F', '{$f_year}', '{$app_no}')";
	$up_obj=$aobj_context->mobj_db->Execute($options_insert);

	if($lobj_rs) 
	{
		$data='Your Application is recieved';
		$arr['message']= $data;
		$arr['app_no'] = $app_no;
		$arr['fslno']  = $slnocnt;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}	
	else
	{
		$arr['message'] = 'Something went wrong please contact help desk';					 
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}
}

function getreprint($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$rappno = trim($aobj_context->mobj_data["rappno"]);
	$rdob  = trim($aobj_context->mobj_data["rdob"]);	
	
	
	$query   = "select fappno,fdob,ifnull(fpaymenttype,'a') as fpaymenttype,
	ifnull(FPAYMENTSTATUS,'')  as fpaymentstatus 
	from studadm where fappno = '{$rappno}' and fdob = date_format(str_to_date('{$rdob}','%d/%m/%Y'),'%Y-%m-%d')";
	
	$results = $aobj_context->mobj_db->getRow($query);

	if($results)
	{	
		$arr['html'] = $results;			 
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;

	}else
	{
		$arr = "";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}

}
?>