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.219.229.101
Current Path : /var/www/html/gcg/adm/src/ |
| Current File : //var/www/html/gcg/adm/src/saveApplication.php |
<?php
require_once(__DIR__."/../../../aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
include_once("/JSON.php");
$json = new Services_JSON();
function saveDetails($aobj_context)
{
$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"]);
$suboption1 = trim($aobj_context->mobj_data["suboption1"]);
//var_dump($suboption1);
$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"]);
$maxmarks = trim($aobj_context->mobj_data["maxmarks"]);
$secmarks = trim($aobj_context->mobj_data["secmarks"]);
$percent = trim($aobj_context->mobj_data["percent"]);
// include_once($aobj_context->main_src."/json.php");
// $json1 = 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);
$rgPerArray = array();
for($i=0; $i<count($per_arr_data); $i++)
{
$rgPerArray[$per_arr_data[$i]['id']] = $per_arr_data[$i]['value'];
}
//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 funivcode from control";
$rst2 = $aobj_context->mobj_db->getRow($query2);
$funivcode = $rst2['funivcode'];
$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,FPREVMAX,FPREVSEC,FPREVPERCENT)
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}','{$maxmarks}','{$secmarks}','{$percent}')";
//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 = "adm/student_photos/{$centercode}_".date("Y")."/".$degree.'/'.$photo_filename;
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
try{
$s3->putObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $funivcode."/".$photo, 'SourceFile' => $image_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);
} catch(S3Exception $e){
$arr = 'Unable to upload photo';
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
// 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 = "adm/student_photos/{$centercode}_".date("Y")."/".$degree."/sign/".$sign_filename;
try{
$s3->putObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $funivcode."/".$sign, 'SourceFile' => $sign_path ]);
$update="update studadm set FSIGNPATH='{$sign}'
where FAPPNO= '{$app_no}' ";
$up_obj=$aobj_context->mobj_db->Execute($update);
unlink($sign_path);
} catch(S3Exception $e){
$arr = 'Unable to upload photo';
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
// 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);
// var_dump($options_insert);
$options_insert = "insert into options(FDEGREE, FEXAMNO,
FCOLLCODE, FSLNO, FSUBCODE,
FDELETED, FYEAR, FAPPNO)
values('{$degree}','{$examno}','{$centercode}', '{$slnocnt}',
'{$suboption1}', 'F', '{$f_year}', '{$app_no}')";
$up_obj=$aobj_context->mobj_db->Execute($options_insert);
//var_dump($options_insert);
$insert = "INSERT ignore INTO studoc
(
fslno,
fappno,
file_path,
created_date,fdegree,fcollcode,fdoctype
)
select '{$app_no}', '{$app_no}', null, now(), '{$degree}',
'{$centercode}', ffilename from masdoc where fdegree = 'UG'";
$lobj_insert= $aobj_context->mobj_db->Execute($insert);
$cert_path = $aobj_context->main_src."/certificates/".$app_no;
//is successfully inserted
if(!file_exists($cert_path))
{
mkdir($cert_path);
}
// ------------- Document Strart -------------------//////
$doc_names = ["PUC","TC","Caste","BANK","BC","aadhar"];
//var_dump($aobj_context->main_src);
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 = "adm/certificates/".date("Y")."/{$app_no}/".$GCCERT_FILENAME;
//var_dump($GCCERT_PATH.'----'.$GCCERT_FILENAME_FILENAME);
try{
$s3->putObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $funivcode."/".$GCCERT, 'SourceFile' => $GCCERT_PATH ]);
$update = "update studoc set file_path = '{$GCCERT}'
where fappno = '{$app_no}'
and fdoctype = '{$doc_names[$i]}'";
$lobj_insert= $aobj_context->mobj_db->Execute($update);
unlink($GCCERT_PATH);
} catch(S3Exception $e){
$arr = 'Unable to upload photo';
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
// if(copy($GCCERT_PATH,$GCCERT_FILENAME_FILENAME))
// {
// $update = "update studoc set file_path = '{$GCCERT}'
// where fappno = '{$app_no}'
// and fdoctype = '{$doc_names[$i]}'";
// $lobj_insert= $aobj_context->mobj_db->Execute($update);
// unlink($GCCERT_PATH);
// }
}
// -------------Document end -------------------//////
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"]);
if(strpos($rappno, '533') !== false)
{
$query = "select fappno,s.fdob ,ifnull(fpaymentype,'a') as fpaymenttype,
ifnull(FPAYMENTSTATUS,'a') as fpaymentstatus from regcandsum cs inner join
student s on cs.fregno = s.fregno
where cs.fappno = '{$rappno}'";
}else
{
$query = "select fappno,fdob,ifnull(fpaymenttype,'a') as fpaymenttype,ifnull(FPAYMENTSTATUS,'a') as fpaymentstatus from studadm where fappno = '{$rappno}'";
//var_dump($query);
}
$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;
}
}
?>
|