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


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

<?php
require_once("/var/www/html/aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;

function loadmakepay_acu($aobj_context){
    // $mob=$_SESSION["MOBILE"];
    $appno=$_SESSION["APPNO"];
    $query="SELECT IFNULL(p.fappno,'')as fappno,
    IFNULL(p.fdegree,'')AS fdegree, 
    IFNULL(p.fcombcode,'')AS fcombcode,
    IFNULL(p.fapptype,'')AS fapptype,
    IFNULL(pc.fdeggname,'')AS fdeggname,
    IFNULL(pc.fcombname,'')AS fcombname,
    ifnull(DATE_FORMAT(p.fdate,'%d/%m/%Y'),'') AS fdate,
    IFNULL(p.fdate,'') AS fdat,
    if( ifnull(fpayid,'') = '',(IFNULL(p.famount,'')+ ifnull(fphdfine,0)),p.famount) AS famount,
    IFNULL(p.fpayid,'')AS fpayid,
    IFNULL(p.fpaydoc,'')AS fpaydoc,
    IFNULL(p.fpaymode,'')AS fpaymode,
    IFNULL(p.fbank,'')AS fbank,
    IFNULL(p.fbranch,'')AS fbranch,
    ifnull(p.fpaystatus,'')AS fpaystatus
    FROM control c, phdappfor p
    inner join phdcoursedet pc on p.fdegree = pc.fdegree and p.fcombcode = pc.fcombcode
    WHERE fappno='{$appno}'";

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

    if($lobj_get_data){

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



function makepaydocupload_acu($aobj_context){
        
    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 = "PAYMENT_BILL".".".$ext;
        
        move_uploaded_file($tempname, 'uploads/'. $new_filename);
    }

    


    if($new_filename){
        $arr['err_code'] = 0;
        $arr['status'] = 'success';
        $arr['paydocuploadedfile']= $new_filename;
        $arr['msg'] = 'Updated Successfully...!';
        echo json_encode($arr);
        return;
    }else {
        $arr['err_code'] = -1;
        $arr['status'] = 'Failure';
        $arr['msg'] = 'Failed To update';
        echo json_encode($arr); 
        return;     
    
}
}




function savemakepay_acu($aobj_context){
        
    $mob=$_SESSION["MOBILE"];
    $fappno=$_SESSION["APPNO"];
    $degree=$aobj_context->mobj_data["degree"];
    $combcode=$aobj_context->mobj_data["combcode"];
    $type=$aobj_context->mobj_data["type"];
    $paydate=$aobj_context->mobj_data["paydate"];
    $amount=$aobj_context->mobj_data["amount"];
    $payid=$aobj_context->mobj_data["payid"];
    $fpaymode=$aobj_context->mobj_data["fpaymode"];
    $fbank=$aobj_context->mobj_data["fbank"];
    $fbranch=$aobj_context->mobj_data["fbranch"];
    $paydoc=$aobj_context->mobj_data["paydoc"];
    $phdpaydoc=$fappno.'_'.$paydoc;


    $arr['msg'] = "Last Date is over";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
    return; 

    $qry = "select fappno from phdacademic
    where fappno = '{$fappno}'";
    
    $rlt =  $aobj_context->mobj_db->GetRow($qry);

    if($rlt['fappno']=="") {
		$arr['msg'] = "Enter Academic Details";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
        return;
	}


    $qry5 = "select fappno ,ifnull(fapptype,'') as fapptype from phdappfor
    where fappno = '{$fappno}'";
    
    $rlt5 =  $aobj_context->mobj_db->GetRow($qry5);
    
    $qry2 = "select fappno from phdpub
    where fappno = '{$fappno}'";
    
    $rlt2 =  $aobj_context->mobj_db->GetRow($qry2);

    // if($rlt5['fapptype'] != 'Part time')
    // {
    //     if($rlt2['fappno'] != "") {
    //         $check = "Select FPUBLICATION from phdupdoc
    //         where  fappno = '{$fappno}'";

    //         $checkrlt1 =  $aobj_context->mobj_db->GetRow($check);

    //         if($checkrlt1['FPUBLICATION'] == ""){
    //             $arr['msg'] = "Upload Research Experience Document..!!";
    //             echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
    //             return;
    //         }
    //     }else if($rlt2['fappno'] == ""){
    //         $arr['msg'] = "Enter Research Experience";
    //         echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
    //         return; 
    //     }
    // }


    
    $qry3 = "select fappno from phdemp
    where fappno = '{$fappno}'";
    
    $rlt3 =  $aobj_context->mobj_db->GetRow($qry3);


    // if($rlt3['fappno'] != "" && $type != "Full time") {
    //     $check2 = "Select FEXP from phdupdoc
    //     where  fappno = '{$fappno}'";


    //     $checkrlt2 =  $aobj_context->mobj_db->GetRow($check2);

    //     if($checkrlt2['FEXP'] == ""){
    //         $arr['msg'] = "Upload Employment Details Document..!!";
    //         echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
    //         return;
    //     }
	// }else if($rlt3['fappno'] == ""){
    //     $arr['msg'] = "Enter Employment Details..!!";
	// 	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
    //     return; 
    // }



    $qry4 = "select fappno from phdstudadm
    where fappno = '{$fappno}'";
    
    $rlt4 =  $aobj_context->mobj_db->GetRow($qry4);


    if($rlt4['fappno'] != "") {
        $check3 = "Select FPHOTOPATH from phdupdoc
        where  fappno = '{$fappno}'";

        $checkrlt3 =  $aobj_context->mobj_db->GetRow($check3);

        if($checkrlt3['FPHOTOPATH'] == ""){
            $arr['msg'] = "Upload Photo..!!";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
            return;
        }
	}else if($rlt4['fappno'] == ""){
        $arr['msg'] = "Enter Enter Personal Details..!!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
        return; 
    }
	


    $qry5 = "select fappno ,ifnull(fapptype,'') as fapptype from phdappfor
    where fappno = '{$fappno}'";
    
    $rlt5 =  $aobj_context->mobj_db->GetRow($qry5);


    if($rlt5['fapptype'] == 'Part time'){
        $check4 = "Select FNOC from phdupdoc
        where fappno = '{$fappno}'";

        $checkrlt4 =  $aobj_context->mobj_db->GetRow($check4);

        if($checkrlt4['FNOC'] == ""){
            $arr['msg'] = "Upload NOC..!!";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
            return;
        }
        $che = "Select FEXP from phdupdoc
        where fappno = '{$fappno}'";

        $checkr =  $aobj_context->mobj_db->GetRow($che);

        if($checkr['FEXP'] == ""){
            $arr['msg'] = "Upload Employment Document..!!";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
            return;
        }

        $check5 = "select fappno from phdemp
        where fappno = '{$fappno}'";
        $checkrlt5 =  $aobj_context->mobj_db->GetRow($check4);

        if($checkrlt5){
           
        }else
        {
            $arr['msg'] = "Enter Employment Details";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
            return;
        }
    }

    


    $qry6 = "select fappno from phdothdet
    where fappno = '{$fappno}'";
    
    $rlt6 =  $aobj_context->mobj_db->GetRow($qry6);

    if($rlt6['fappno']=="" && $type != "Full time") {
		$arr['msg'] = "Enter Other Details";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
        return;
	}




    $qry7 = "select fappno,ifnull(fphdexam,'') as fphdexam from phdugcnet
    where fappno = '{$fappno}'";
    
    $rlt7 =  $aobj_context->mobj_db->GetRow($qry7);


    if($rlt7['fappno'] != '')
    {
        if($rlt7['fphdexam'] == 'Yes')
        {
            $check5 = "Select fugcdoc from phdugcnet
            where fappno = '{$fappno}'";
            $checkrlt5 =  $aobj_context->mobj_db->GetRow($check5);

            if($checkrlt5['fugcdoc'] == "")
            {
                $arr['msg'] = "Upload UGC - NET Document!";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
                return;
            }
        }
    }


    $qryupd = "select fappno,ifnull(FSIGNPATH,'') as FSIGNPATH,ifnull(FAADHAARPATH,'') as FAADHAARPATH 
    from phdupdoc
    where fappno = '{$fappno}'";
    
    $rltqryupd =  $aobj_context->mobj_db->GetRow($qryupd);

    if($rltqryupd['FSIGNPATH'] == ""){
        $arr['msg'] = "Upload Signature";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
            return;
    }else if($rltqryupd['FAADHAARPATH'] == ""){
        $arr['msg'] = "Upload Aadhar / Passport";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
            return;
    }


    $qryugc = "select ifnull(fphdexam,'') as fphdexam, ifnull(fugcdoc, '')as fugcdoc
    from phdugcnet
    where fappno = '{$fappno}'";
    
    $rltqryugc =  $aobj_context->mobj_db->GetRow($qryugc);

    // if($rltqryugc['fphdexam'] == ""){
    //     $arr['msg'] = "Select claiming for Ph.D Enterance Examination Exemption as per ACU-Ph.D Regulations 2022 in UGC-NET Details";
    //         echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
    //         return;
    // }

    if($rltqryugc['fphdexam'] == 'Yes' && $rltqryugc['fugcdoc'] === ''){
        $qryphdent = "select ifnull(FPHDENT,'') as fphdent
        from phdupdoc
        where fappno = '{$fappno}'";

        $rltqryphdent =  $aobj_context->mobj_db->GetRow($qryphdent);

        if($rltqryphdent['fphdent'] == ""){
            $arr['msg'] = "Upload Ph.D Enterance Examination Exemption as per ACU-Ph.D Regulations 2022";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
                return;
        }
    }
	


    if($paydoc){
        $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($phdpaydoc != '' && $phdpaydoc != NULL)
        {
            $image_path = $aobj_context->main_src."uploads/{$paydoc}";
            $ext = pathinfo($photo_filename, PATHINFO_EXTENSION);
            $tphoto = $funivcode."/phd_certificates/".$phdpaydoc;
            
            // var_dump($photo);
            if(file_exists($image_path)) 
            {
                try {
                    $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $tphoto, 'SourceFile' => $image_path]);
                    $query = "update phdappfor set fpaydoc = '{$tphoto}'
                    where fappno = '{$fappno}' and fdegree = '{$degree}' and fcombcode = '{$combcode}'";

                    $run =  $aobj_context->mobj_db->Execute($query);
                    unlink($image_path);
                }catch(S3Exception $e) {
                    $arr['message'] = 'Unable to upload file';
                    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                    return;
                }
            }
        }
    }
    
        $query = "update phdappfor set fdate = '{$paydate}',
        famount = '{$amount}',fpayid = '{$payid}',
        fbank = '{$fbank}',fbranch = '{$fbranch}',
        fpaymode = '{$fpaymode}',
        fappsubdate = now()
        where fappno = '{$fappno}' and fdegree = '{$degree}' 
        and fcombcode = '{$combcode}'";
        
        $run =  $aobj_context->mobj_db->Execute($query);

        $qry = "update phdstudadm set fpaystatus='success', fpaydate=now() where 
                  fappno = '{$fappno}'";
        $res =  $aobj_context->mobj_db->Execute($qry);


        if($run){
        $arr['msg'] = "Updated Successfully..!!";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
        }else{
        $arr['msg'] = 'Failed to Update';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
        }

    
}   


?>