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 : 3.141.32.252


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

<?php
    require_once("/var/www/html/aws/aws-autoloader.php");
    use Aws\S3\S3Client;
    use Aws\S3\Exception\S3Exception;
    function loaddetails_acu($aobj_context){
        $mob=$_SESSION["MOBILE"];
        $appno=$_SESSION["APPNO"];
        
        $query="SELECT IFNULL(fname,'')AS fname, 
        IFNULL(ffatname,'')AS ffatname,
        IFNULL(fmotname,'')AS fmotname,
        ifnull(fpassport,'') as passport,
        ifnull(FDOMICILE,'') as fdomicile,
        fdob AS fdob, 
        IFNULL(FNATIONALITY,'')AS FNATIONALITY, IFNULL(fcategory,'')AS fcategory,
        IFNULL(fgender,'')AS fgender,
        IFNULL(FRELIGION,'')AS FRELIGION, IFNULL(FBLOODGRP,'')AS FBLOODGRP,
        IFNULL(FAADHAAR,'')as FAADHAAR,IFNULL(FFATOCC,'')as FFATOCC,
        IFNULL(FFATMOBILENO,'')as FFATMOBILENO, IFNULL(FMOTOCC,'')as FMOTOCC,
        IFNULL(FMOTMOBILENO,'')as FMOTMOBILENO,
        IFNULL(FGUARDNAME,'')as FGUARDNAME,
        IFNULL(FGUARDOCC,'')as FGUARDOCC,
        IFNULL(FGUARDMOBILENO,'')as FGUARDMOBILENO,
        IFNULL(FMOTTONGUE,'')as FMOTTONGUE,
        IFNULL(fpermadd1,'')AS fpermadd1, IFNULL(fpermadd2,'')AS fpermadd2, 
        IFNULL(fpermadd3,'')AS fpermadd3, IFNULL(fpermdist,'')AS fpermdist, IFNULL(fpermpin,'')AS fpermpin,
        IFNULL(fpermstate,'')AS fpermstate,IFNULL(fcurradd1,'')AS fcurradd1,
        IFNULL(fcurradd2,'')AS fcurradd2,IFNULL(fcurradd3,'')AS fcurradd3,IFNULL(fcurrdist,'')AS fcurrdist,
        IFNULL(fcurrstate,'')AS fcurrstate, IFNULL(fcurrpin,'')AS fcurrpin,
        IFNULL(FMOBILENO,'')AS FMOBILENO,
        IFNULL(FEMAIL,'')AS FEMAIL
        FROM phdstudadm where fmobileno='$mob' and FAPPNO='{$appno}'";

        $lobj_get_data = $aobj_context->mobj_db->GetRow($query);  

         $qry1 = "select ifnull(FPAYSTATUS,'') as FPAYSTATUS 
        from phdstudadm
        where fappno = '{$appno}'";
        $rlt1 = $aobj_context->mobj_db->GetRow($qry1);

        if($lobj_get_data){
        $arr['personal'] = $lobj_get_data;
        $arr['success'] = $rlt1;
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
        }else{
            $arr['msg'] = 'Failed to load';
		    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
        }
    }                                                           

    function  personaldetails_acu($aobj_context){
       

        
        $mob=$_SESSION["MOBILE"];
        $fappno=$_SESSION["APPNO"];
        $fname=$aobj_context->mobj_data["cname"];
        $ffatname=$aobj_context->mobj_data["fname"];
        $fmotname=$aobj_context->mobj_data["mname"];
        $fdob=$aobj_context->mobj_data["dob"];
        $fnational=$aobj_context->mobj_data["nationality"];
        $fcategory=$aobj_context->mobj_data["category"];
        $fgender=$aobj_context->mobj_data["gender"];
        $fdomicile=$aobj_context->mobj_data["fdomicile"];
        
        $fpermadd1=$aobj_context->mobj_data["padd1"];
        $fpermadd2=$aobj_context->mobj_data["padd2"];
        $fpermadd3=$aobj_context->mobj_data["padd3"];
        $fpermdist=$aobj_context->mobj_data["pdist"];
        $fpermpin=$aobj_context->mobj_data["ppin"];
        $fpermstate=$aobj_context->mobj_data["pstate"];

        $fcurradd1=$aobj_context->mobj_data["cadd1"];
        $fcurradd2=$aobj_context->mobj_data["cadd2"];
        $fcurradd3=$aobj_context->mobj_data["cadd3"];
        $fcurrdist=$aobj_context->mobj_data["cdist"];
        $fcurrstate=$aobj_context->mobj_data["cstate"];
        $fcurrpin=$aobj_context->mobj_data["cpin"];
        $faadharno=$aobj_context->mobj_data["aadhar"];
        
        $femail=$aobj_context->mobj_data["femail"];
        $fatocc=$aobj_context->mobj_data["fatocc"];
        $passport=$aobj_context->mobj_data["passport"];
        $fatmobno=$aobj_context->mobj_data["fatmobno"];
        $motmobno=$aobj_context->mobj_data["motmobno"];
        $motocc=$aobj_context->mobj_data["motocc"];
        $guardname=$aobj_context->mobj_data["guardname"];
        $guardmobno=$aobj_context->mobj_data["guardmobno"];
        $guardocc=$aobj_context->mobj_data["guardocc"];
        $mother_tongue=$aobj_context->mobj_data["mother_tongue"];
        $religion=$aobj_context->mobj_data["religion"];
        $blood_grp=$aobj_context->mobj_data["blood_grp"];

        $qry = "select fpaystatus from phdstudadm where fmobileno='{$mob}' and FAPPNO='{$fappno}'";
        $res = $aobj_context->mobj_db->GetRow($qry);
        
        if($res['fpaystatus']==='success'){
            $arr['msg'] = "You are not allowed to edit";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;
        }
        
        $query="update phdstudadm set
        fname='{$fname}', ffatname='{$ffatname}', fmotname='{$fmotname}',
        fdob='{$fdob}',
        FNATIONALITY='{$fnational}',fcategory='{$fcategory}',
        fgender='{$fgender}',FAADHAAR='{$faadharno}',
        fdomicile = '{$fdomicile}',
        fpassport = '{$passport}',
        fpermadd1='{$fpermadd1}', fpermadd2='{$fpermadd2}', 
        fpermadd3='{$fpermadd3}', fpermdist='{$fpermdist}', 
        fpermpin='{$fpermpin}', fpermstate='{$fpermstate}',

        fcurradd1='{$fcurradd1}',FEMAIL='{$femail}',
        fcurradd2='{$fcurradd2}',fcurradd3='{$fcurradd3}',
        fcurrdist='{$fcurrdist}', fcurrstate='{$fcurrstate}', 
        fcurrpin='{$fcurrpin}',

        FFATOCC='{$fatocc}', FFATMOBILENO='{$fatmobno}', FMOTOCC='{$motocc}', 
        FMOTMOBILENO='{$motmobno}', FGUARDNAME='{$guardname}', 
        FGUARDOCC='{$guardocc}', FGUARDMOBILENO='{$guardmobno}',
        FMOTTONGUE='{$mother_tongue}', FBLOODGRP='{$blood_grp}', FRELIGION='{$religion}' 

        where fmobileno='{$mob}' and FAPPNO='{$fappno}'"; 

        $lobj_get_data = $aobj_context->mobj_db->Execute($query);

        if($lobj_get_data)
        {	
        $arr['msg']="Success";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
        return;
        }
        else
        {
        $arr['msg'] = "Fail to save";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
        return;
        }
    }

    function research_publication_acu($aobj_context){
        $mob=$_SESSION["MOBILE"];
        $fappno=$_SESSION["APPNO"];
        $area=$aobj_context->mobj_data["area"];
        $title=$aobj_context->mobj_data["title"];
        $place=$aobj_context->mobj_data["place"];
        $frmdate=$aobj_context->mobj_data["frmdate"];
        $todate=$aobj_context->mobj_data["todate"];
        $res_pub=$aobj_context->mobj_data["res_pub"];
        $patent=$aobj_context->mobj_data["patent"];
        $conference_att=$aobj_context->mobj_data["conference_att"];
        $awards=$aobj_context->mobj_data["awards"];
        $totpub=$aobj_context->mobj_data["totpub"];
        $totpatents=$aobj_context->mobj_data["totpatents"];
        $totconfatt=$aobj_context->mobj_data["totconfatt"];
        $totconfpart=$aobj_context->mobj_data["totconfpart"];
        $totawards=$aobj_context->mobj_data["totawards"];
        $id = $aobj_context->mobj_data["id"];

        $qry = "select fpaystatus from phdstudadm where fmobileno='{$mob}' and FAPPNO='{$fappno}'";
        $res = $aobj_context->mobj_db->GetRow($qry);
        
        if($res['fpaystatus']==='success'){
            $arr['msg'] = "You are not allowed to edit";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;
        }

        if($id == ""){
            $query="insert into phdpub(FAPPNO, fresarea, ftitle, fplace, ffrmdate, ftodate, frespub,
                ftotpub, fpatents, ftotpatents, fconfatt, ftotconfatt, ftotconfpart, fawards, ftotawards)
                values('{$fappno}','{$area}','{$title}','{$place}','{$frmdate}','{$todate}',
                '{$res_pub}','{$totpub}','{$patent}','{$totpatents}','{$conference_att}',
                '{$totconfatt}','{$totconfpart}','{$awards}','{$totawards}')";
                
            $result = $aobj_context->mobj_db->Execute($query);
        }else{
            $query = "update phdpub set fresarea='{$area}',ftitle='{$title}',fplace='{$place}',ffrmdate='{$frmdate}',ftodate='{$todate}',
                frespub='{$res_pub}',ftotpub='{$totpub}',fpatents='{$patent}',ftotpatents='{$totpatents}',fconfatt='{$conference_att}',
                ftotconfatt='{$totconfatt}',ftotconfpart='{$totconfpart}',fawards='{$awards}',ftotawards='{$totawards}' where fid = '{$id}'";

            $result = $aobj_context->mobj_db->Execute($query);
        }

        if($result)
        {	
        $arr['msg'] = "Saved";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
        return;
        }
        else
        {
        $arr['msg'] = "Fail to save";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
        return;
        }
    }

    function view_research_experience_acu($aobj_context){
        $mobileno = $_SESSION['MOBILE'];
        $appno = $_SESSION['APPNO'];

        $query = "select *, date_format(str_to_date(ffrmdate,'%Y-%m-%d'),'%d/%m/%Y')as ffromdate,
                  date_format(str_to_date(ftodate,'%Y-%m-%d'),'%d/%m/%Y')as ftoodate
                  from phdpub where FAPPNO='{$appno}'";
        $result = $aobj_context->mobj_db->GetAll($query);

        if($result)
        {	
        echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
        return;
        }
        else
        {
        $arr['msg'] = "Fail to load";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
        return;
        }
    }

    function delete_research_exp_acu($aobj_context){
        $mobileno = $_SESSION['MOBILE'];
        $appno = $_SESSION['APPNO'];
        $id = $aobj_context->mobj_data["fid"];

        $query = "delete from phdpub where fid = '{$id}' and fappno='{$appno}'";
        $result = $aobj_context->mobj_db->Execute($query);

        if($result)
        {	
        echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
        return;
        }
        else
        {
        $arr['msg'] = "Fail to delete";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
        return;
        }
    }

    function photo_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];
        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "Photo".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $phdphoto =  $appno.'_'.$new_filename;
        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];
            
            if($phdphoto != '' && $phdphoto != NULL){
                $image_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $photo = $funivcode."/phd_photos/".$phdphoto;
                
                if(file_exists($image_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $photo, 'SourceFile' => $image_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FPHOTOPATH='{$photo}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FPHOTOPATH, FAPPNO) values('{$photo}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($image_path);
                            $arr['message'] = 'Photo Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Photo';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Photo';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function sign_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "SIGN".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $phdsign =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($phdsign != '' && $phdsign != NULL){
                $sign_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $sign = $funivcode."/phd_photos/".$phdsign;
                
                if(file_exists($sign_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $sign, 'SourceFile' => $sign_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FSIGNPATH='{$sign}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FSIGNPATH, FAPPNO) values('{$sign}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($sign_path);
                            $arr['message'] = 'Signature Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Signature';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Signature';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function aadhaar_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "AADHAAR".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $phdaadhaar =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($phdaadhaar != '' && $phdaadhaar != NULL){
                $aadhaar_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $aadhaar = $funivcode."/phd_photos/".$phdaadhaar;
                
                if(file_exists($aadhaar_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $aadhaar, 'SourceFile' => $aadhaar_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FAADHAARPATH='{$aadhaar}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FAADHAARPATH, FAPPNO) values('{$aadhaar}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($aadhaar_path);
                            $arr['message'] = 'Aadhaar Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload aadhaar';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload aadhaar';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    
    function proof_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "ENT_EXAM_PROOF".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $proofcert =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($proofcert != '' && $proofcert != NULL){
                $proof_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $proof = $funivcode."/phd_photos/".$proofcert;
                
                if(file_exists($proof_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $proof, 'SourceFile' => $proof_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FPROOFENT='{$proof}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FPROOFENT, FAPPNO) values('{$proof}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($proof_path);
                            $arr['message'] = 'Proof Certificate for Entrance Examination Exception Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Certificate for Entrance Examination Exception';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Certificate for Entrance Examination Exception';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function noc_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "NOC".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $noc_proof =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($noc_proof != '' && $noc_proof != NULL){
                $noc_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $noc = $funivcode."/phd_photos/".$noc_proof;
                
                if(file_exists($noc_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $noc, 'SourceFile' => $noc_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FNOC='{$noc}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FNOC, FAPPNO) values('{$noc}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($noc_path);
                            $arr['message'] = 'Proof Certificate for Entrance Examination Exception Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Certificate for Entrance Examination Exception';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Certificate for Entrance Examination Exception';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function exp_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "EXPERIENCE".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $exp_proof =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($exp_proof != '' && $exp_proof != NULL){
                $exp_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $exp = $funivcode."/phd_photos/".$exp_proof;
                
                if(file_exists($exp_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $exp, 'SourceFile' => $exp_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FEXP='{$exp}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FEXP, FAPPNO) values('{$exp}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($exp_path);
                            $arr['message'] = 'Experience certificate Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Experience certificate';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Experience certificate';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function publication_upload_acu($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "PUBLICATION".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $pub_proof =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($pub_proof != '' && $pub_proof != NULL){
                $pub_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $pub = $funivcode."/phd_photos/".$pub_proof;
                
                if(file_exists($pub_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $pub, 'SourceFile' => $pub_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FPUBLICATION='{$pub}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FPUBLICATION, FAPPNO) values('{$pub}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($pub_path);
                            $arr['message'] = 'Publications Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Publications';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Publications';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function PhD_Enterance_Examination($aobj_context){
        $appno = $_SESSION['APPNO'];

        if ( 0 < $_FILES['file']['error'] ) {
            echo 'Error: ' . $_FILES['file']['error'] . '<br>';
        }
        else {
            $tempname = $_FILES['file']['tmp_name'];
            $filename = $_FILES['file']['name'];
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $new_filename = "PHD_ENT_EXAM".".".$ext;
        
            move_uploaded_file($tempname, 'uploads/'. $new_filename);
        }

        $phd_proof =  $appno.'_'.$new_filename;

        

        if($new_filename){
            $s3 = S3Client::factory(
                array(
                    'credentials' => array(
                        'key' => IAM_KEY,
                        'secret' => IAM_SECRET
                    ),
                    'version' => "latest",
                    'region'  => 'ap-south-1'
                )
            );

            
            $query = "select funivcode from control";
            $results = $aobj_context->mobj_db->GetRow($query);
    
            $funivcode = $results['funivcode'];

            
            if($phd_proof != '' && $phd_proof != NULL){
                $phd_path = $aobj_context->main_src."uploads/{$new_filename}";
                
                $phdent = $funivcode."/phd_photos/".$phd_proof;
                
                if(file_exists($phd_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $phdent, 'SourceFile' => $phd_path]);
                        $query = "select * from phdupdoc where FAPPNO = '{$appno}'";
                        $result = $aobj_context->mobj_db->GetRow($query);
                        if($result['FAPPNO'] == $appno){
                            $update = "update phdupdoc set FPHDENT='{$phdent}' where FAPPNO='{$appno}'";
                            $result_1 = $aobj_context->mobj_db->Execute($update);
                        }else{
                            $insert="insert into phdupdoc (FPHDENT, FAPPNO) values('{$phdent}', '{$appno}')";
                            $result_1=$aobj_context->mobj_db->Execute($insert);
                        }

                        if($result_1){
                            unlink($phd_path);
                            $arr['message'] = 'Ph.D Enterance Examination Exemption  Uploaded';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                            return;
                        }else{
                            $arr['message'] = 'Unable to upload Ph.D Enterance Examination Exemption ';
                            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                            return;
                        }
                    }catch(S3Exception $e) {
                        $arr['message'] = 'Unable to upload Ph.D Enterance Examination Exemption ';
                        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                        return;
                    }
                }
            }
        }else {
            $arr['err_code'] = -1;
            $arr['status'] = 'Failure';
            $arr['msg'] = 'Failed To update';
            echo json_encode($arr); 
            return;       
         }
    }

    function view_documents_acu($aobj_context){
        $appno = $_SESSION['APPNO'];
        $query = "select * from phdupdoc where fappno = '{$appno}'";
        $result = $aobj_context->mobj_db->GetRow($query);
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
            return;
        }else{
            $arr['message'] = 'No data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;
        }
    }
?>