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


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

<?php

function saveBarcodeDeatils($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $v1 = trim($aobj_context->mobj_data["v1"]);
    $v2 = trim($aobj_context->mobj_data["v2"]);
    $v3 = trim($aobj_context->mobj_data["v3"]);
    $univcode = trim($aobj_context->mobj_data["univcode"]);
    
    // $v1 = trim($aobj_context->req_body["v1"]);
    // $v2 = trim($aobj_context->req_body["v2"]);
    // $v3 = trim($aobj_context->req_body["v3"]);

    $regno = "";
    $fqpcode = "";
    $ansbook = "";

    if(strlen($v1) == 5)
    {
        $fqpcode = $v1;
        $regno = $v2;
        $ansbook = $v3;

    }else if(strlen($v2) == 5)
    {
        $fqpcode = $v2;
        $regno = $v1;
        $ansbook = $v3;

    }else if(strlen($v3) == 5)
    {
        $fqpcode = $v3;
        $regno = $v1;
        $ansbook = $v2;
    }

    $query = "select distinct fregno from student where fregno in('{$regno}','{$ansbook}')";
    $result = $aobj_context->pobj_db->getRow($query);

    if($result['fregno'] == '')
    {
        $arr['msg'] = 'Invalid Register No.';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }

    $fregno = $result['fregno'];

    $fansbook = ($fregno != $ansbook) ? $ansbook : $regno;

    $query = "update ansstud set fansbookno = '{$fansbook}'
    where fregno = '{$fregno}' and fqpcode = '{$fqpcode}'";
    $result = $aobj_context->pobj_db->Execute($query);

    $query = "select * from ansstud where fregno = '{$fregno}' and fqpcode = '{$fqpcode}'";
    $res = $aobj_context->pobj_db->GetRow($query);    
    
    $fdoe      = $res['fdoe'];
    $fsession  = $res['fsession'];
    $fcntrcode = $res['fcntrcode'];
    $froomno   = $res['froomno'];
    $fyear     = $res['fyear'];
    $fexamtype = $res['fexamtype'];

    $query = "insert into anstran(funivcode, fregno, fqpcode, fdoe, fsession, fcntrcode, froomno, fyear, fexamtype, fansbookno, fscandate) 
    values ('{$univcode}', '{$fregno}', '{$fqpcode}', '{$fdoe}','{$fsession}','{$fcntrcode}','{$froomno}', '{$fyear}','{$fexamtype}','{$fansbook}',now())";
    $result = $aobj_context->pobj_db->Execute($query);
    //var_dump($query);
    if ($result)
    {
        $arr['fregno'] = $fregno;
        $arr['fans'] = $fansbook;
        $arr['fqpcode'] = $fqpcode;
        $arr['msg'] = 'Updated successfully.';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
        return;
    } else {
        $arr['msg'] = 'Something Went wrong';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

?>