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.227.46.87
<?php
function saveApplication($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$reg_no = $aobj_context->mobj_data["reg_no"];
include_once($aobj_context->main_src."/json.php");
$json = new Services_JSON();
//recieve decode json string of personal info
$lstr_param = stripslashes($aobj_context->mobj_data["personal_info"]);
$per_arr_data = json_decode($lstr_param, true);
////recieve decode json string of subject info
$strSubject = stripslashes($aobj_context->mobj_data["pRgSubjects"]);
$sub_arr_data = json_decode($strSubject, true);
$strSubjects = implode("','", $sub_arr_data);
//convert to Associative array
$rgPerArray = array();
for($i=0; $i<count($per_arr_data); $i++)
{
$rgPerArray[$per_arr_data[$i]['id']] = $per_arr_data[$i]['value'];
}
//For phd admissions assuming examno and college code
$examno = 'A';
$centercode = 'KUS';
//Auto increment serial numbers
$query2 = "select right(concat('0000',ifnull(max(FSLNO),0)+01),4)
as FSLNO from studadm
where FCOLLCODE='{$centercode}'";
$rst2 = $aobj_context->mobj_db->getRow($query2);
$slnocnt = $rst2['FSLNO'];
//generate application numbers
$app_no = '50318'.$centercode.$slnocnt;
//insert to studadm
$strInsertQuery = "insert into studadm
(FSLNO, FCOLLCODE, FEXAMNO, FNAME, FFATNAME, FMOTNAME,
FCASTE, FSUBCASTE, FRELIGION, FSEX,
FHANDICAP,FNATIONAL, FDOB, FAADHARNO,
FCURRADD1, FCURRADD2,FCURRADD3, FCURDISTRICT,
FCURSTATE, FCURPINCODE,
FPERMADD1, FPERMADD2,FPERMADD3, FPERDISTRICT,
FPERSTATE, FPERPINCODE,
FCONTACT_NO, FLANDLINE, FEMAIL,
FBANKACNO, FBANKBRANCH, FIFSCCODE,
FDEGREE, FAPPNO, FTOTFEE,FPROVREGNO,FPROVREGDATE,
FCREATEDATE, FCREATEUSER)
values('{$slnocnt}', '{$centercode}', '{$examno}','{$rgPerArray['studname']}',
'{$rgPerArray['fatname']}', '{$rgPerArray['motname']}',
'{$rgPerArray['category']}',
'{$rgPerArray['caste']}', '{$rgPerArray['religion']}',
'{$rgPerArray['gender']}', '{$rgPerArray['handicap']}',
'{$rgPerArray['nationality']}',
date_format(str_to_date('{$rgPerArray['dob']}','%d/%m/%Y'),'%Y-%m-%d'),
'{$rgPerArray['adhar']}', '{$rgPerArray['cadd1']}',
'{$rgPerArray['cadd2']}', '{$rgPerArray['cadd3']}',
'{$rgPerArray['cdistrict']}', '{$rgPerArray['cstate']}',
'{$rgPerArray['cpincode']}', '{$rgPerArray['padd1']}',
'{$rgPerArray['padd2']}', '{$rgPerArray['padd3']}',
'{$rgPerArray['pdistrict']}', '{$rgPerArray['pstate']}',
'{$rgPerArray['ppincode']}', '{$rgPerArray['mobile']}',
'{$rgPerArray['landline']}', '{$rgPerArray['email']}',
'{$rgPerArray['accnumber']}',
'{$rgPerArray['branch']}', '{$rgPerArray['ifsc']}',
'{$rgPerArray['degree']}', '{$app_no}','{$rgPerArray['sum']}',
'{$rgPerArray['prregno']}',
date_format(str_to_date('{$rgPerArray['prregdate']}','%d/%m/%Y'),'%Y-%m-%d'),
NOW(),'{$rgPerArray['studname']}')";
$boolSaRes = $aobj_context->mobj_db->Execute($strInsertQuery);
//is successfully inserted
if($boolSaRes)
{
//update photo path
$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";
$photo_filename = $rgPerArray['photo_path'];
$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}'";
$up_obj=$aobj_context->mobj_db->Execute($update);
unlink($image_path);
}
//update signature path
$sign_filename = $rgPerArray['sign_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 '{$rgPerArray['degree']}', '{$examno}', '{$centercode}',
'{$slnocnt}',fsubcode, 'F', '2018', '{$app_no}'
from subject where fdegree = '{$rgPerArray['degree']}' and fexamno = '{$examno}'
and fsubcode in ('{$strSubjects}') and fintass = 'F'";
$up_obj=$aobj_context->mobj_db->Execute($options_insert);
}
if($boolSaRes && $up_obj)
{
$data='Your Application is recieved';
$arr['message']= $data;
$arr['app_no'] = $app_no;
$arr['slno'] = $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(FPAYTYPE,'') as fpaymenttype,
ifnull(FPAYSTATUS,'') as fpaymentstatus,ifnull(ffinsub,'') as ffinsub
from phdstudadm
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;
}
}
|