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.145.37.211
<?php
require_once(_DIR_."/../../../aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
function saveApplication($aobj_context)
{
// $bucketName = 'logisys-uploads';
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$reg_no = $aobj_context->mobj_data["reg_no"];
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
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);
// $fappno = stripslashes($aobj_context->mobj_data["fappno"]);
$final_submit = stripslashes($aobj_context->mobj_data["final"]);
////recieve decode json string of subject info
$strSubject = stripslashes($aobj_context->mobj_data["pRgSubjects"]);
$sub_arr_data = json_decode($strSubject, true);
$aobj_context->main_src = realpath(__DIR__ . '/../..');
$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
$degree = $rgPerArray['idDegree'];
$college = $rgPerArray['idCollege'];
if($degree == '' || $college == '')
{
$arr['message'] = '1. Error in saving admission details. Send query through I NEED HELP.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
$fappno = '';
$query = "select FCONTACT_NO, fappno from studadm
where FCONTACT_NO = '{$rgPerArray['stuMobileno']}'";
$studresult = $aobj_context->mobj_db->GetRow($query);
$query = "select funivcode from control";
$funiv = $aobj_context->mobj_db->GetRow($query);
$FUNIVCODE = $funiv["funivcode"];
if(count($studresult) >0)
$fappno = $studresult['fappno'];
if($fappno == '')
{
$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);
$rgPerArray['cadd1'] = $rgPerArray['cadd1'];
$rgPerArray['cadd2'] = $rgPerArray['cadd2'];
$rgPerArray['cadd3'] = $rgPerArray['cadd3'];
$rgPerArray['padd1'] = $rgPerArray['padd1'];
$rgPerArray['padd2'] = $rgPerArray['padd2'];
$rgPerArray['padd3'] = $rgPerArray['padd3'];
// $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,FPERMADD1,
FPERMADD2,FPERMADD3,FRELIGION,FMOBILE_NO,
FCATBIRTH,FINCOME,FAADHARNO,
FUNIVNAME,FQUALEXREGNO, FSTUTYPE, FMEDIUM, FQUOTA,
FAPPNO,FAREA,FQMONTH,FQYEAR,FQSECMARKS,FQMAXMARKS,FQPERCENTAGE,FBLOOD_GROUP,
FTYPEQUALEXAM,fcombcode,FPERDIST,FPERPINCODE,
FPERSATE,FCOMDIST,FCOMPINCODE,FCOMSTATE,FFINSUB, FCREATEDATE, FCREATEUSER,fincomecert,fcastecert,fph)
values
('{$sl_no}','{$rgPerArray['idDegree']}',
'{$rgPerArray['idCollege']}','{$rgPerArray['idStudname']}',
'{$rgPerArray['gender']}',date_format(STR_TO_DATE('{$rgPerArray['idDob']}','%d/%m/%Y'),'%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['idCaste']}',
'{$rgPerArray['income']}','{$rgPerArray['adhar']}',
'{$rgPerArray['idUnvName']}','{$rgPerArray['idUnvRegno']}',
'{$rgPerArray['sttype']}','{$rgPerArray['medium']}','{$rgPerArray['adquota']}',
'{$rgPerArray['stuMobileno']}',
'{$rgPerArray['area']}',
'{$rgPerArray['idUnvPassMth']}','{$rgPerArray['idUnvPassYear']}',
'{$rgPerArray['idUnvSecMarks']}','{$rgPerArray['idUnvMaxMarks']}',
'{$rgPerArray['idUnvPerc']}','{$rgPerArray['idBldgrp']}',
'{$rgPerArray['idUnvExam']}',
'{$rgPerArray['idDegComb']}','{$rgPerArray['pdistrict']}',
'{$rgPerArray['ppincode']}','{$rgPerArray['pstate']}','{$rgPerArray['cdistrict']}',
'{$rgPerArray['cpincode']}','{$rgPerArray['cstate']}','{$final_submit}', now(), 'student',
'{$rgPerArray['fincomecert']}','{$rgPerArray['fcastecert']}','{$rgPerArray['fph']}')";
// var_dump($insert_qry);
$results = $aobj_context->mobj_db->Execute($insert_qry);
if($results)
{
$query = "select studadm.internal_code, studadm.fdegree, studadm.fcollcode,
studadm.fslno, control.funivcode from studadm, control
where fcontact_no = '{$rgPerArray['stuMobileno']}'
and fappno = '{$rgPerArray['stuMobileno']}'";
$results2 = $aobj_context->mobj_db->GetRow($query);
if(count($results2) > 0)
{
$internal_code = $results2['internal_code'];
$degree = $results2['fdegree'];
$college = $results2['fcollcode'];
$sl_no = $results2['fslno'];
$funivcode = substr($results2['funivcode'],1,2);
$fappno = '5'.$funivcode.$internal_code;
$query = "update studadm set fappno = '{$fappno}'
where fcontact_no = '{$rgPerArray['stuMobileno']}'
and fappno = '{$rgPerArray['stuMobileno']}'";
$results3 = $aobj_context->mobj_db->Execute($query);
}
else
{
$arr['message'] = '2. Error in saving admission details. Send query through I NEED HELP.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
if(count($sub_arr_data) > 0)
{
for($k=0;$k<count($sub_arr_data);$k++)
{
if($sub_arr_data[$k] != '')
{
$insSubs .= "('{$degree}', 'A', '{$college}', '{$sl_no}', '{$sub_arr_data[$k]}', 'F', '{$fappno}'),";
}
}
$insSubs = rtrim($insSubs,',');
$query = "insert into options(FDEGREE, FEXAMNO, FCOLLCODE,
FSLNO, FSUBCODE, FDELETED, FAPPNO)
values
{$insSubs}";
$optresults = $aobj_context->mobj_db->Execute($query);
}
if(substr(strtoupper($degree),0,1) == 'M' )
{
$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[] = "('{$fappno}' ,'{$rgPerArray['idCollege']}' ,'{$degree}',
'{$sub_marks[$j]["subcode_$i"]}','{$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 = "delete from qualsubdet where fappno = '{$fappno}'";
// $deloptresults = $aobj_context->mobj_db->Execute($query);
if(count($sub_marks) > 0)
{
$query = 'INSERT INTO qualsubdet(fappno,
fcollcode, fdegree, fsubcode,
fsubname, fsecmarksa, fmaxmarksa,
fsecmarksb, fmaxmarksb,
fsecmarksc, fmaxmarksc,
fsecmarksd, fmaxmarksd,
fsecmarkse, fmaxmarkse,
fsecmarksf, fmaxmarksf,
ftotsecmarks, ftotmaxmarks,
fsubpercent
) VALUES '.implode(',', $sql);
// var_dump($query);
$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);
}
// ------------- Document Strart -------------------//////
$insert = "INSERT INTO studoc
(
app_no,
login_cnt,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
select '{$sl_no}', '{$fappno}', null, now(), '{$degree}',
'{$college}', ffilename from masdoc where fdegree = 'BA1'";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
$doc_names = ['ADHAAR', 'CASTE', 'INCOME', 'SSLCMC', 'TCCERT', 'PUMC', 'GCCERT'];
for($i=0;$i<count($doc_names);$i++)
{
$GCCERT = $rgPerArray['h_'.$doc_names[$i]];
if($GCCERT == '')
continue;
$GCCERT_PATH = $aobj_context->main_src.'/upload/'.$GCCERT;
$filename = explode(".", $GCCERT_PATH);
$ext = strtolower($filename[1]);
$GCCERT_FILENAME = $doc_names[$i];
$GCCERT_FILENAME = $GCCERT_FILENAME.".".$ext;
$GCCERT_FILENAME_FILENAME = $cert_path."/".$GCCERT_FILENAME;
$GCCERT = $FUNIVCODE."/certificates/{$fappno}/".$GCCERT_FILENAME;
$GCCERT_upd = "certificates/{$fappno}/".$GCCERT_FILENAME;
if(file_exists($GCCERT_PATH)) {
try {
$s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $GCCERT, 'SourceFile' => $GCCERT_PATH]);
$update = "";
$update = "update studoc set file_path = '{$GCCERT_upd}'
where login_cnt = '{$fappno}'
and fdoctype = '{$doc_names[$i]}'";
$lobj_insert= $aobj_context->mobj_db->Execute($update);
unlink($GCCERT_PATH);
} catch(S3Exception $e){
$arr['message'] = 'Unable to upload documents';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
// if($s3->putObject(['Bucket' => $this->bucket, 'Key' => $path, 'Body' => $data]))
// {
// $update = "";
// $update = "update studoc set file_path = '{$GCCERT}'
// where login_cnt = '{$fappno}'
// and fdoctype = '{$doc_names[$i]}'";
// $lobj_insert= $aobj_context->mobj_db->Execute($update);
// unlink($GCCERT_PATH);
// }
}
// -------------Document end -------------------//////
}
}
else
{
$query = "update studadm set
fdegree = '{$rgPerArray['idDegree']}',
FCOLLCODE = '{$rgPerArray['idCollege']}',
FNAME = '{$rgPerArray['idStudname']}',
FGENDER = '{$rgPerArray['gender']}',
FSTUTYPE = '{$rgPerArray['sttype']}',
FDOB = DATE_FORMAT(STR_TO_DATE('{$rgPerArray['idDob']}','%d/%m/%Y'),'%Y-%m-%d'),
FFATNAME = '{$rgPerArray['idFatname']}',
FMOTNAME = '{$rgPerArray['idMotname']}',
FEMAIL = '{$rgPerArray['stuEmail']}',
FCASTE = '{$rgPerArray['idCategory']}',
FCONTACT_NO = '{$rgPerArray['stuMobileno']}',
FNATIONAL = '{$rgPerArray['idNationality']}',
FMEDIUM = '{$rgPerArray['medium']}',
FQUOTA = '{$rgPerArray['adquota']}',
FCURRADD1 = '{$rgPerArray['cadd1']}',
FCURRADD2 = '{$rgPerArray['cadd2']}',
FCURRADD3 = '{$rgPerArray['cadd3']}',
FCOMDIST = '{$rgPerArray['cdistrict']}',
FCOMPINCODE = '{$rgPerArray['cpincode']}',
FCOMSTATE = '{$rgPerArray['cstate']}',
FPERMADD1 = '{$rgPerArray['padd1']}',
FPERMADD2 = '{$rgPerArray['padd2']}',
FPERMADD3 = '{$rgPerArray['padd3']}',
FPERDIST = '{$rgPerArray['pdistrict']}',
FPERPINCODE = '{$rgPerArray['ppincode']}',
FPERSATE = '{$rgPerArray['pstate']}',
FRELIGION = '{$rgPerArray['idReligion']}',
FMOBILE_NO = '{$rgPerArray['pmobileno']}',
FCATBIRTH = '{$rgPerArray['idCaste']}',
FINCOME = '{$rgPerArray['income']}',
FAADHARNO = '{$rgPerArray['adhar']}',
FUNIVNAME = '{$rgPerArray['idUnvName']}',
FQUALEXREGNO = '{$rgPerArray['idUnvRegno']}',
FAREA = '{$rgPerArray['area']}',
FQMONTH = '{$rgPerArray['idUnvPassMth']}',
FQYEAR = '{$rgPerArray['idUnvPassYear']}',
FQMAXMARKS = '{$rgPerArray['idUnvMaxMarks']}',
FQSECMARKS = '{$rgPerArray['idUnvSecMarks']}',
FQPERCENTAGE = '{$rgPerArray['idUnvPerc']}',
FBLOOD_GROUP = '{$rgPerArray['idBldgrp']}',
FTYPEQUALEXAM = '{$rgPerArray['idUnvExam']}',
fcombcode = '{$rgPerArray['idDegComb']}',
fincomecert = '{$rgPerArray['fincomecert']}',
fcastecert = '{$rgPerArray['fcastecert']}',
fph = '{$rgPerArray['fph']}',
flogdate = now(),
ffinsub = '{$final_submit}'
where fappno = '{$fappno}'";
$results = $aobj_context->mobj_db->Execute($query);
//var_dump($query);
if($results)
{
$query = "select fslno from studadm where fappno = '{$fappno}'";
$res = $aobj_context->mobj_db->GetRow($query);
$sl_no = $res['fslno'];
if(count($sub_arr_data) >0)
{
$query = "delete from options where fappno = '{$fappno}'";
$deloptresults = $aobj_context->mobj_db->Execute($query);
for($k=0;$k<count($sub_arr_data);$k++)
{
if($sub_arr_data[$k] != '')
{
$insSubs .= "('{$rgPerArray['idDegree']}', 'A', '{$rgPerArray['idCollege']}', '{$sl_no}', '{$sub_arr_data[$k]}', 'F', '{$fappno}'),";
}
}
$insSubs = rtrim($insSubs,',');
$query = "insert into options(FDEGREE,
FEXAMNO,
FCOLLCODE,
FSLNO,
FSUBCODE,
FDELETED,fappno)
values
{$insSubs}";
$optresults = $aobj_context->mobj_db->Execute($query);
}
if(substr(strtoupper($degree),0,1) == 'M' )
{
$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[] = "('{$fappno}' ,'{$rgPerArray['idCollege']}' ,'{$degree}',
'{$sub_marks[$j]["subcode_$i"]}','{$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 = "delete from qualsubdet where fappno = '{$fappno}'";
$deloptresults = $aobj_context->mobj_db->Execute($query);
$query = 'INSERT INTO qualsubdet(fappno,
fcollcode, fdegree, fsubcode,
fsubname, fsecmarksa, fmaxmarksa,
fsecmarksb, fmaxmarksb,
fsecmarksc, fmaxmarksc,
fsecmarksd, fmaxmarksd,
fsecmarkse, fmaxmarkse,
fsecmarksf, fmaxmarksf,
ftotsecmarks, ftotmaxmarks,
fsubpercent
) VALUES '.implode(',', $sql);
// var_dump($query);
$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);
}
// ------------- Document Strart -------------------//////
$doc_names = ['ADHAAR', 'CASTE', 'INCOME', 'SSLCMC', 'TCCERT', 'PUMC', 'GCCERT'];
for($i=0;$i<count($doc_names);$i++)
{
$GCCERT = $rgPerArray['h_'.$doc_names[$i]];
if($GCCERT == '')
continue;
$GCCERT_PATH = $aobj_context->main_src.'/upload/'.$GCCERT;
$filename = explode(".", $GCCERT_PATH);
$ext = strtolower($filename[1]);
$GCCERT_FILENAME = $doc_names[$i];
$GCCERT_FILENAME = $GCCERT_FILENAME.".".$ext;
$GCCERT_FILENAME_FILENAME = $cert_path."/".$GCCERT_FILENAME;
$GCCERT = $FUNIVCODE."/certificates/{$fappno}/".$GCCERT_FILENAME;
$GCCERT_upd = "certificates/{$fappno}/".$GCCERT_FILENAME;
if(file_exists($GCCERT_PATH))
{
try{
$s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $GCCERT, 'SourceFile' => $GCCERT_PATH]);
$update = '';
$update = "update studoc set file_path = '{$GCCERT_upd}'
where login_cnt = '{$fappno}'
and fdoctype = '{$doc_names[$i]}'";
// var_dump($update);
$lobj_insert= $aobj_context->mobj_db->Execute($update);
unlink($GCCERT_PATH);
} catch(S3Exception $e){
$arr['message'] = 'Unable to upload documents';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
// if(copy($GCCERT_PATH,$GCCERT_FILENAME_FILENAME))
// {
// $update = "update studoc set file_path = '{$GCCERT}'
// where login_cnt = '{$fappno}'
// and fdoctype = '{$doc_names[$i]}'";
// // var_dump($update);
// $lobj_insert= $aobj_context->mobj_db->Execute($update);
// unlink($GCCERT_PATH);
// }
}
// -------------Document 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'];
if($photo_filename != '')
{
$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 = $FUNIVCODE."/student_photos/{$college}/".$degree.'/'.$photo_filename;
$photo_upd = "student_photos/{$college}/".$degree.'/'.$photo_filename;
if(file_exists($image_path))
{
try{
$s3->putObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $photo, 'SourceFile' => $image_path]);
$update="update studadm set FPHOTOPATH='{$photo_upd}'
where FAPPNO= '{$fappno}'";
$up_obj=$aobj_context->mobj_db->Execute($update);
unlink($image_path);
} catch(S3Exception $e){
$arr['message'] = 'Unable to upload photo';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
// 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'];
if($sign_filename != '')
{
$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 = $FUNIVCODE."/student_photos/{$college}/".$degree."/sign/".$sign_filename;
$sign_upd = "student_photos/{$college}/".$degree."/sign/".$sign_filename;
if(file_exists($sign_path))
{
try{
$s3->putObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $sign, 'SourceFile' => $sign_path]);
$update="update studadm set FSIGNPATH='{$sign_upd}'
where FAPPNO='{$fappno}' ";
$up_obj=$aobj_context->mobj_db->Execute($update);
unlink($sign_path);
} catch(S3Exception $e){
$arr['message'] = 'Unable to upload Signature';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
// if(copy($sign_path,$full_file_path_sign))
// {
// $update="update studadm set FSIGNPATH='{$sign_upd}'
// where FAPPNO='{$fappno}' ";
// $up_obj=$aobj_context->mobj_db->Execute($update);
// unlink($sign_path);
// }
}
$data='Your Application is submitted successfully.';
$arr['message']= $data;
$arr['app_no'] = $fappno;
$arr['slno'] = $slnocnt;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$arr['message'] = 'Error in submitting the application.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function rePrintApplication($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select ifnull(fappno,'') as fappno from studadm
where FCONTACT_NO = '{$_SESSION['MOBILE']}' and ffinsub = 'T'";
$obj = $aobj_context->mobj_db->GetRow($query);
// var_dump($obj);
$row['appno'] = $obj['fappno'];
$row['error_code'] = '0';
if($obj['fappno'] == '')
{
$row['error_code'] = '1';
}
echo json_encode($row);
}
|