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 : 13.59.217.1
<?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);
$rgMultiMarks = stripslashes($aobj_context->mobj_data["rgMultiMarks"]);
$MultiMarks_arr_data = json_decode($rgMultiMarks, 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
$get_last_no="select right(concat('0000',ifnull(max(FSLNO),0)+01),4) as app_no
from studadm
WHERE FDEGREE='{$rgPerArray['idDegree']}' and FCOLLCODE = '{$rgPerArray['idCollege']}'";
$obj = $aobj_context->mobj_db->GetRow($get_last_no);
$sl_no = "0000".$obj['app_no'];
$sl_no = substr($sl_no, -4);
$degree = $rgPerArray['idDegree'];
$college = $rgPerArray['idCollege'];
$query = "select FADMPREFIX from control";
$results = $aobj_context->mobj_db->GetRow($query);
$FADMPREFIX = $results['FADMPREFIX'];
$query = "select internal_code+1 as FAUTOINCREMENT from studadm
order by internal_code desc limit 1";
$results = $aobj_context->mobj_db->GetRow($query);
$FAUTOINCREMENT = $results['FAUTOINCREMENT'];
$appno = $FADMPREFIX.$FAUTOINCREMENT;
$fappno = $appno;
$insert_qry="insert into studadm
(FSLNO,FDEGREE,FCOLLCODE,FNAME,FGENDER,FDOB,
FEXAMNO,FFATNAME,FMOTNAME,FEMAIL,FCASTE,
FCONTACT_NO,FNATIONAL,FCURRADD1,FCURRADD2,FCURRADD3,FCURRADD4,FPERMADD1,
FPERMADD2,FPERMADD3,FPERMADD4,FRELIGION,FMOBILE_NO,
FNATCANDIDATE,FSTATE,FCATBIRTH,FADMDATE,FFATINCOME,FAADHARNO,
FINSTLOCAT,FUNIVNAME,FQUALEXREGNO,
FPASSYER, FPASSMNTH, FPERMARK,
FHK,FAPPNO,FPOB,FAREA,FHANDICAP,
FNCC,FNSS,FDEFENCE,FEXSERVE,FKASHIMG,
FTRANS,FUNIVADD,FUNIVPHONE,FPRNNO,FCOLLPHONE,FSPORTS,FOBSATE,
FWOBSATE,FQMONTH,FQYEAR,FQMAXMARKS,FQSECMARKS,FQPERCENTAGE,FBLOOD_GROUP,
FPRNNO10, FQUALEXREGNO10, FINSTNAME10, FCOLLADD10, FCOLLSTATE10,
FCOLLPHONE10, FUNIVNAME10, FUNIVADD10, FUNIVPHONE10, FQMONTH10,
FQYEAR10, FQMAXMARKS10, FQSECMARKS10, FQPERCENTAGE10 )
values
('{$sl_no}','{$rgPerArray['idDegree']}',
'{$rgPerArray['idCollege']}','{$rgPerArray['idStudname']}',
'{$rgPerArray['gender']}',date_format('{$rgPerArray['idDob']}','%Y-%m-%d'),
'A','{$rgPerArray['idFatname']}',
'{$rgPerArray['idMotname']}','{$rgPerArray['stuEmail']}',
'{$rgPerArray['idCategory']}','{$rgPerArray['stuMobileno']}',
'{$rgPerArray['idNationality']}','{$rgPerArray['cadd1']}','{$rgPerArray['cadd2']}',
'{$rgPerArray['cadd3']}','','{$rgPerArray['padd1']}','{$rgPerArray['padd2']}',
'{$rgPerArray['padd3']}','','{$rgPerArray['idReligion']}','{$rgPerArray['pmobileno']}',
'{$rgPerArray['idNation']}','{$rgPerArray['stuState']}','{$rgPerArray['cstate']}',
date_format(now(),'%Y-%m-%d'),'{$rgPerArray['income']}','{$rgPerArray['adhar']}',
'{$rgPerArray['idCollAdd']}','{$rgPerArray['idUnvName']}','{$rgPerArray['idUnvRegno']}',
'{$rgPerArray['idUnvPassYear']}','{$rgPerArray['idUnvPassMth']}',
'{$rgPerArray['idUnvPerc']}','{$rgPerArray['chkHydKar']}','{$fappno}',
'{$rgPerArray['idPob']}','{$rgPerArray['area']}','{$rgPerArray['phd']}',
'{$rgPerArray['ncc']}','{$rgPerArray['nss']}','{$rgPerArray['dfp']}',
'{$rgPerArray['exs']}','{$rgPerArray['kai']}','{$rgPerArray['trg']}',
'{$rgPerArray['idUnvAdd']}','{$rgPerArray['idUnvPhone']}',
'{$rgPerArray['idUnvPrnno']}','{$rgPerArray['idCollPhone']}',
'{$rgPerArray['spr']}','{$rgPerArray['obs']}','{$rgPerArray['osb']}',
'{$rgPerArray['idUnvPassMth']}','{$rgPerArray['idUnvPassYear']}',
'{$rgPerArray['idUnvSecMarks']}','{$rgPerArray['idUnvMaxMarks']}',
'{$rgPerArray['idUnvPerc']}','{$rgPerArray['idBldgrp']}',
'{$rgPerArray['idSchPrnno']}','{$rgPerArray['idSchRegno']}',
'{$rgPerArray['idSchName']}','{$rgPerArray['idSchAdd']}',
'{$rgPerArray['idSchState']}','{$rgPerArray['idSchPhone']}',
'{$rgPerArray['idSchBoard']}','{$rgPerArray['idSchBoardAdd']}',
'{$rgPerArray['idSchoolBoardPhone']}','{$rgPerArray['idSchPassMth']}',
'{$rgPerArray['idSchPassYear']}','{$rgPerArray['idSchMaxMarks']}',
'{$rgPerArray['idSchSecMarks']}','{$rgPerArray['idSchPerc']}'
)";
$results = $aobj_context->mobj_db->Execute($insert_qry);
for($k=0;$k<count($sub_arr_data);$k++)
{
$query = "insert into options(FDEGREE,
FEXAMNO,
FCOLLCODE,
FSLNO,
FSUBCODE,
FDELETED,fappno)
values
(
'{$degree}',
'A',
'{$college}',
'{$sl_no}',
'{$sub_arr_data[$k]}',
'F','{$fappno}')";
$optresults = $aobj_context->mobj_db->Execute($query);
}
//insert to studadm
$mobj_jsondata = json_decode($rgMultiMarks,true);
//var_dump($this->mobj_jsondata);
$sub_marks = array();
for($i=0; $i<count($mobj_jsondata); $i++)
{
for($j=0;$j<count($mobj_jsondata[$i]);$j++)
{
$sub_marks[$i][$mobj_jsondata[$i][$j]['name']] = $mobj_jsondata[$i][$j]['value'];
}
}
$sql = array();
$j=0;
for($i=1; $i<=count($sub_marks);$i++)
{
$sql[] = "('{$sl_no}'
,'{$fappno}'
,'{$collcode}'
,'{$degree}'
,'{$sub_marks[$j]["subsem1_$i"]}',
'{$sub_marks[$j]["subsem1mo_$i"]}'
,'{$sub_marks[$j]["subsem1mm_$i"]}'
,'{$sub_marks[$j]["subsem2mo_$i"]}'
,'{$sub_marks[$j]["subsem2mm_$i"]}'
,'{$sub_marks[$j]["subsem3mo_$i"]}'
,'{$sub_marks[$j]["subsem3mm_$i"]}'
,'{$sub_marks[$j]["subsem4mo_$i"]}'
,'{$sub_marks[$j]["subsem4mm_$i"]}'
,'{$sub_marks[$j]["subsem5mo_$i"]}'
,'{$sub_marks[$j]["subsem5mm_$i"]}'
,'{$sub_marks[$j]["subsem6mo_$i"]}'
,'{$sub_marks[$j]["subsem6mm_$i"]}'
,'{$sub_marks[$j]["subtotalmo_$i"]}'
,'{$sub_marks[$j]["subtotalmm_$i"]}'
,'{$sub_marks[$j]["subpercentagemm_$i"]}')";
$j++;
}
$query = 'INSERT INTO qualdet(fslno, fappno,
fcollcode, fdegree,
fsubname, fsecmarksa , fmaxmarksa,
fsecmarksb, fmaxmarksb,
fsecmarksc, fmaxmarksc,
fsecmarksd, fmaxmarksd,
fsecmarkse, fmaxmarkse,
fsecmarksf, fmaxmarksf,
ftotsecmarks, ftotmaxmarks,
fsubpercent
) VALUES '.implode(',', $sql);
$resultqualdets = $aobj_context->mobj_db->Execute($query);
$cert_path = $aobj_context->main_src."certificates/".$fappno;
//is successfully inserted
if(!file_exists($cert_path))
{
mkdir($cert_path);
}
// -------------ADHAAR start-------------------//////
$ADHAAR = $rgPerArray['h_ADHAAR'];
$ADHAAR_PATH = $aobj_context->main_src.$ADHAAR;
$filename = explode(".", $ADHAAR_PATH);
$ext = strtolower($filename[1]);
$ADHAAR_FILENAME = "ADHAAR";
$ADHAAR_FILENAME = $ADHAAR_FILENAME.".".$ext;
$full_file_ADHAAR_FILENAME = $cert_path."/".$ADHAAR_FILENAME;
$ADHAAR = "certificates/{$fappno}/".$ADHAAR_FILENAME;
if(copy($ADHAAR_PATH,$full_file_ADHAAR_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'ADHAAR'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$ADHAAR}',now(),'{$degree}','{$college}','ADHAAR'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($ADHAAR_PATH);
}
// -------------ADHAAR end -------------------//////
// ------------- HK371 start -------------------//////
$HK371 = $rgPerArray['h_HK371'];
$HK371_PATH = $aobj_context->main_src.$HK371;
$filename = explode(".", $HK371_PATH);
$ext = strtolower($filename[1]);
$HK371_PATH_FILENAME = "HK371";
$HK371_PATH_FILENAME = $HK371_PATH_FILENAME.".".$ext;
$full_file_HK371_FILENAME = $cert_path."/".$HK371_PATH_FILENAME;
$HK371 = "certificates/{$fappno}/".$HK371_PATH_FILENAME;
if(copy($HK371_PATH,$full_file_HK371_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'HK371'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$HK371}',now(),'{$degree}','{$college}','HK371'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($HK371_PATH);
}
// -------------HK371 end -------------------//////
// ------------- h_INCOME start -------------------//////
$INCOME = $rgPerArray['h_INCOME'];
$INCOME_PATH = $aobj_context->main_src.$INCOME;
$filename = explode(".", $INCOME_PATH);
$ext = strtolower($filename[1]);
$INCOME_FILENAME = "INCOME";
$INCOME_FILENAME = $INCOME_FILENAME.".".$ext;
$INCOME_FILENAME_FILENAME = $cert_path."/".$INCOME_FILENAME;
$INCOME = "certificates/{$fappno}/".$INCOME_FILENAME;
if(copy($INCOME_PATH,$INCOME_FILENAME_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'INCOME'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$INCOME}',now(),'{$degree}','{$college}','INCOME'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($INCOME_PATH);
}
// -------------INCOME end -------------------//////
// ------------- h_CASTE start -------------------//////
$CASTE = $rgPerArray['h_CASTE'];
$CASTE_PATH = $aobj_context->main_src.$CASTE;
$filename = explode(".", $CASTE_PATH);
$ext = strtolower($filename[1]);
$CASTE_FILENAME = "CASTE";
$CASTE_FILENAME = $CASTE_FILENAME.".".$ext;
$CASTE_FILENAME_FILENAME = $cert_path."/".$CASTE_FILENAME;
$CASTE = "certificates/{$fappno}/".$CASTE_FILENAME;
if(copy($CASTE_PATH,$CASTE_FILENAME_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'CASTE'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$CASTE}',now(),'{$degree}','{$college}','CASTE'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($CASTE_PATH);
}
// -------------CASTE end -------------------//////
// ------------- h_SSLCMC start -------------------//////
$SSLCMC = $rgPerArray['h_SSLCMC'];
$SSLCMC_PATH = $aobj_context->main_src.$SSLCMC;
$filename = explode(".", $SSLCMC_PATH);
$ext = strtolower($filename[1]);
$SSLCMC_FILENAME = "SSLCMC";
$SSLCMC_FILENAME = $SSLCMC_FILENAME.".".$ext;
$SSLCMC_FILENAME_FILENAME = $cert_path."/".$SSLCMC_FILENAME;
$SSLCMC = "certificates/{$fappno}/".$SSLCMC_FILENAME;
if(copy($SSLCMC_PATH,$SSLCMC_FILENAME_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'SSLCMC'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$SSLCMC}',now(),'{$degree}','{$college}','SSLCMC'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($SSLCMC_PATH);
}
// -------------SSLCMC end -------------------//////
// ------------- h_TCCERT start -------------------//////
$TCCERT = $rgPerArray['h_TCCERT'];
$TCCERT_PATH = $aobj_context->main_src.$TCCERT;
$filename = explode(".", $TCCERT_PATH);
$ext = strtolower($filename[1]);
$TCCERT_FILENAME = "TCCERT";
$TCCERT_FILENAME = $TCCERT_FILENAME.".".$ext;
$TCCERT_FILENAME_FILENAME = $cert_path."/".$TCCERT_FILENAME;
$TCCERT = "certificates/{$fappno}/".$TCCERT_FILENAME;
if(copy($TCCERT_PATH,$TCCERT_FILENAME_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'TCCERT'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$TCCERT}',now(),'{$degree}','{$college}','TCCERT'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($TCCERT_PATH);
}
// -------------TCCERT end -------------------//////
// ------------- h_PUMC start -------------------//////
$PUMC = $rgPerArray['h_PUMC'];
$PUMC_PATH = $aobj_context->main_src.$PUMC;
$filename = explode(".", $PUMC_PATH);
$ext = strtolower($filename[1]);
$PUMC_FILENAME = "PUMC";
$PUMC_FILENAME = $PUMC_FILENAME.".".$ext;
$PUMC_FILENAME_FILENAME = $cert_path."/".$PUMC_FILENAME;
$PUMC = "certificates/{$fappno}/".$PUMC_FILENAME;
if(copy($PUMC_PATH,$PUMC_FILENAME_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'PUMC'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$PUMC}',now(),'{$degree}','{$college}','PUMC'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($PUMC_PATH);
}
// -------------PUMC end -------------------//////
// ------------- GCCERT start -------------------//////
$GCCERT = $rgPerArray['h_GCCERT'];
$GCCERT_PATH = $aobj_context->main_src.$GCCERT;
$filename = explode(".", $GCCERT_PATH);
$ext = strtolower($filename[1]);
$GCCERT_FILENAME = "GCCERT";
$GCCERT_FILENAME = $GCCERT_FILENAME.".".$ext;
$GCCERT_FILENAME_FILENAME = $cert_path."/".$GCCERT_FILENAME;
$GCCERT = "certificates/{$fappno}/".$GCCERT_FILENAME;
if(copy($GCCERT_PATH,$GCCERT_FILENAME_FILENAME))
{
$query = "delete from studoc where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'GCCERT'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$GCCERT}',now(),'{$degree}','{$college}','GCCERT'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($GCCERT_PATH);
}
// -------------GCCERT end -------------------//////
// ------------- NSS start -------------------//////
$NSS = $rgPerArray['h_NSS'];
$NSS_PATH = $aobj_context->main_src.$NSS;
$filename = explode(".", $NSS_PATH);
$ext = strtolower($filename[1]);
$NSS_FILENAME = "NSS";
$NSS_FILENAME = $NSS_FILENAME.".".$ext;
$NSS_FILENAME_FILENAME = $cert_path."/".$NSS_FILENAME;
$NSS = "certificates/{$fappno}/".$NSS_FILENAME;
if(copy($NSS_PATH,$NSS_FILENAME_FILENAME))
{
$query = "delete from studoc
where login_cnt = '{$fappno}'
and fappno = '{$sl_no}'
and fdoctype = 'NSS'";
$studocresults = $aobj_context->mobj_db->Execute($query);
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
values
(
'{$sl_no}',
'{$fappno}',
'{$NSS}',now(),'{$degree}','{$college}','NSS'
)";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
unlink($NSS_PATH);
}
// -------------GCCERT end -------------------//////
if($results)
{
//update photo path
$college_path=$aobj_context->main_src."student_photos/{$college}";
$degree_path=$aobj_context->main_src."student_photos/{$college}/".$degree;;
$folder_path=$aobj_context->main_src."student_photos/{$college}/".$degree;;
$sign_folder_path = $aobj_context->main_src."student_photos/{$college}/".$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 = $college."_".$degree."_".$fappno;
$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/{$college}/".$degree.'/'.$photo_filename;
if(copy($image_path,$full_file_path))
{
$update="update studadm set FPHOTOPATH='{$photo}'
where FAPPNO= '{$fappno}'";
$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 = $college."_".$degree."_".$fappno."_sign";
$sign_filename = $sign_filename.".".$ext;
$full_file_path_sign = $folder_path."/sign/".$sign_filename;
$sign = "student_photos/{$college}/".$degree."/sign/".$sign_filename;
if(copy($sign_path,$full_file_path_sign))
{
$update="update studadm set FSIGNPATH='{$sign}'
where FAPPNO= '{$fappno}' ";
$up_obj=$aobj_context->mobj_db->Execute($update);
unlink($sign_path);
}
}
if($results && $optresults)
{
$data='Your Application is recieved';
$arr['message']= $data;
$arr['app_no'] = $fappno;
$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;
}
}
|