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


Current Path : /var/www/html/admission/src/
Upload File :
Current File : /var/www/html/admission/src/define_heads.php

<?php
function headsdetails($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
   
    $query = "SELECT fheadname, fid, fdeleted FROM notifhead ";
    $result = $aobj_context->pobj_db->GetAll($query);
//     var_dump($result);
//    die();
    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    } 
}
function headsdates($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $user = $aobj_context->mobj_data['user'];
    $table = json_decode($aobj_context->mobj_data['data'], true);
   
    foreach($table as $key=>$val){

        $qryId = "select * from notifhead where fid='{$val['fid']}'";
        $resId = $aobj_context->pobj_db->GetRow($qryId);
       
        if(count($resId) > 0){
            $query="update notifhead set fheadname='{$val['fheadname']}', 
                    fdeleted='{$val['fdeleted']}', fcreateddate=now(), 
                    fcreateduser='{$user}' where fid='{$val['fid']}'";
        }else{
            $query = "insert into notifhead (fheadname, fdeleted, fcreateddate, fcreateduser)
                      values('{$val['fheadname']}','{$val['fdeleted']}',now(),'{$user}')";       
        }
        
        $result = $aobj_context->pobj_db->Execute($query);
    }

    if($result){
        $arr['msg'] = "Heads updated successfully";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not updated";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    } 
}

?>