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


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/uGrievances.php

<?php

function uniclareGetStudentGrievances($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

    $univcode = $aobj_context->mobj_data['univcode'];
    $regno = $aobj_context->mobj_data['regno'];

    $query = "select fgrvid, fgrvsub, date_format(fgrvdate, '%d/%m/%Y %h:%i %p') as fgrvdate 
    from logisys3_grv.grvhead where fregno = '{$regno}' and funivcode = '{$univcode}' order by fgrvdate desc";
    
    $result = $aobj_context->mobj_db->GetAll($query);
    
    if(count($result) <= 0)
    {
        $arr['msg'] = 'No Grievances Found';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        return;
    }
    else {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
    }
}

function uniclareGetGrievanceDetl($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

    $grvid = $aobj_context->mobj_data['grvid'];

    $query = "select fgrvsub, fgrvstatus, fgrvmsg, date_format(fgrvdate, '%d/%m/%Y %h:%i %p') as fgrvdate,
    if(ifnull(ffilepath,'') = '', '', concat('https://studentportal.universitysolutions.in/grvfiles/', ffilepath)) as ffilepath 
    from logisys3_grv.grvhead where fgrvid = '{$grvid}'";
    
    $result = $aobj_context->mobj_db->GetRow($query);

    if(count($result) <= 0)
    {
        $arr['msg'] = 'Invalid Grv. id.';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        return;
    }

    $res['grvhead'] = $result;

    $query = "select fgrvid, fgrvtranid, date_format(fgrvtrandate, '%d/%m/%Y %h:%i %p') as fgrvdate, 
    ffromuser, fgrvtranmsg, ifnull(fgrvtrantype, 'RES') as fgrvtrantype 
    from logisys3_grv.grvdetl where fgrvid = '{$grvid}'";
    
    $result = $aobj_context->mobj_db->GetAll($query);

    $res['grvdetl'] = $result;

    echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
}

function uniclareSubmitGrvDetl($aobj_context)
{
    $aobj_context->mobj_db->SetFetchmode(ADODB_FETCH_ASSOC);

    $data = $aobj_context->req_body['data'];

    $fgrvid = $data['fgrvid'];
    $ffromuser = $data['ffromuser'];
    $fgrvtransub = $data['fgrvtransub'];
    $fgrvtranmsg = $data['fgrvtranmsg'];

    if($fgrvid == "" || $ffromuser == "" || $fgrvtransub == "" || $fgrvtranmsg == "" ) {
        $arr['msg'] = 'Invalid Params.';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        return;
    }

    $query = "insert into logisys3_grv.grvdetl( fgrvid, fgrvtrandate, ffromuser, fgrvtransub, fgrvtranmsg, fgrvtrantype )
    values( '{$fgrvid}',  now(),  '{$ffromuser}', '{$fgrvtransub}', '{$fgrvtranmsg}', 'REQ')";
    $result = $aobj_context->mobj_db->Execute($query);

    if($result) {
        $arr['msg'] = 'Query submitted.';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
        return;
    }
    else {
        $arr['msg'] = 'Error while submitting query.';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        return;
    }
}