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.129.63.214


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.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 loaddetails($aobj_context){
        $mob=$_SESSION["MOBILE"];
        $appno=$_SESSION["APPNO"];
        
        $query="SELECT IFNULL(fname,'')AS fname, 
        IFNULL(ffatname,'')AS ffatname,
        IFNULL(fmotname,'')AS fmotname,
        IFNULL(FPHOTOPATH,'')AS FPHOTOPATH,
        DATE_FORMAT(fdob,'%d/%m/%Y') AS fdob, 
        IFNULL(fnational,'')AS fnational, IFNULL(fcategory,'')AS fcategory,
        IFNULL(fhk,'')AS fhk, IFNULL(fgender,'')AS fgender,
        IFNULL(faadharno,'')as aadhar,
        IFNULL(fph,'')AS fph, 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(femploy,'')AS femploy,
        IFNULL(fnocdoc,'')AS fnocdoc,IFNULL(fcastedoc,'')AS fcastedoc,IFNULL(fhkdoc,'')AS fhkdoc,IFNULL(FMOBILENO,'')AS FMOBILENO,
        IFNULL(FEMAIL,'')AS FEMAIL
         FROM phdstudadm where fmobileno='$mob'";

        $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($aobj_context){
        // $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $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"];
        $fhkk=$aobj_context->mobj_data["kk"];
        $fph=$aobj_context->mobj_data["pc"];
        $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"];
        $employ=$aobj_context->mobj_data["employ"];
        $femail=$aobj_context->mobj_data["femail"];
        $photo=$aobj_context->mobj_data["photopath"];
        $caste=$aobj_context->mobj_data["fcaste"];
        $noc=$aobj_context->mobj_data["fnoc"];
        $hk=$aobj_context->mobj_data["fhk"];
        $fcaste=$fappno.'_'.$caste;
        $fnoc=$fappno.'_'.$noc;
        $fhk=$fappno.'_'.$hk;


        $phdphoto=$fappno.'_'.$photo;


        if($photo){
            $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($phdphoto != '' && $phdphoto != NULL)
            {
                $image_path = $aobj_context->main_src."uploads/{$photo}";

                
                $ext = pathinfo($photo_filename, PATHINFO_EXTENSION);
                $photo_filename = $fappno;
               
                
                $photo = $funivcode."/phd_photos/".$phdphoto;
                
                if(file_exists($image_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $photo, 'SourceFile' => $image_path]);
                        $update="update phdstudadm set FPHOTOPATH='{$photo}' 
                            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($noc){
            $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($fnoc != '' && $fnoc != NULL)
            {
                $image_path = $aobj_context->main_src."uploads/{$noc}";

                
                $ext = pathinfo($photo_filename, PATHINFO_EXTENSION);
                $photo_filename = $fappno;
               
                
                $fdocnoc = $funivcode."/phd_certificates/".$fnoc;
                
                if(file_exists($image_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $fdocnoc, 'SourceFile' => $image_path]);
                        $update="update phdstudadm set fnocdoc='{$fdocnoc}' 
                            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($caste){
            $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($fcaste != '' && $fcaste != NULL)
            {
                $image_path = $aobj_context->main_src."uploads/{$caste}";

                
                $ext = pathinfo($photo_filename, PATHINFO_EXTENSION);
                $photo_filename = $fappno;
               
                
                $fdoccaste = $funivcode."/phd_certificates/".$fcaste;
                
                if(file_exists($image_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $fdoccaste, 'SourceFile' => $image_path]);
                        $update="update phdstudadm set fcastedoc='{$fdoccaste}' 
                            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($hk){
            $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($fhk != '' && $fhk != NULL)
            {
                $image_path = $aobj_context->main_src."uploads/{$hk}";

                
                $ext = pathinfo($photo_filename, PATHINFO_EXTENSION);
                $photo_filename = $fappno;
               
                
                $fdochk = $funivcode."/phd_certificates/".$fhk;
                
                if(file_exists($image_path)) 
                {
                    try {
                        $s3->putObject(['Bucket' => ADMISSION_CERTIFICATES, 'Key' => $fdochk, 'SourceFile' => $image_path]);
                        $update="update phdstudadm set fhkdoc='{$fdochk}' 
                            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;
                    }
                }
            }
        }
        



        $query="update phdstudadm set
        fname='$fname', ffatname='$ffatname', fmotname='$fmotname',
        fdob=date_format(str_to_date('$fdob','%d/%m/%Y'),'%Y-%m-%d'),
        fnational='$fnational',fcategory='$fcategory',fgender='$fgender',faadharno='$faadharno',
        fph='$fph', fhk='$fhkk', 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',femploy = '$employ' where fmobileno='$mob'"; 

        // var_dump($query);
        // die();

        $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;
        }
    }
?>