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


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

<?php

function get_deggrp($aobj_context)
{

    $univcode = $aobj_context->mobj_data["univcode"];

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $query = "SELECT fdbname FROM dbname WHERE funivcode = $univcode";
    $result = $aobj_context->mobj_db->GetRow($query);
    $db = $result['fdbname'];

    $query = "SELECT DISTINCT fdeggrp FROM {$db}.masqp WHERE IFNULL(fdeggrp,'') <> ''";
    
    $result = $aobj_context->mobj_db->GetAll($query);
    // var_dump($result);
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'Degree group not found for the selected university';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

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

    $deggrp = $aobj_context->mobj_data["deggrp"];
    foreach($deggrp as $key => $value){
        $deg .= "'".$value."',";
    }
    $deggrp_arr = substr_replace($deg ,"",-1);
    

    $query = "select DISTINCT fboardcode, fboardname
        FROM masboard mb, masqp mq
        WHERE  mb.fboardcode=mq.fboard AND mq.fdeggrp = '{$deggrp}' order by fboardcode";
    $result = $aobj_context->pobj_db->GetAll($query);
    

    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No Boards for selected University or Degree grp';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getscript($aobj_context)
{

    $univcode = $aobj_context->mobj_data["univcode"];
    $Degree = $aobj_context->mobj_data["deggrp"];
    $fboard = $aobj_context->mobj_data["fboard"];
    $fexamno = $aobj_context->mobj_data["fexamno"];
    $status = $aobj_context->mobj_data["status"];

    if($fboard == 'All'){
        $cnd1 = "";
    }else{
        $cnd1 = "and m.fboard = '{$fboard}'";
    }

    if ($status == "All") {
        $cnd2 = "";
    } else if ($status == "completed") {
        if($Degree == 'PG')
        {
            $cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) = 0
            and (ifnull(ftotpkt2,0) - ifnull(fvalpkt2,0)) = 0";
        }else
        {
            $cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) = 0";
            
        }
        //$cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) = 0";
    } else if ($status == "pending") {

        if($Degree == 'PG')
        {
            $cnd2 = "and ((ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) <> 0
            or  (ifnull(ftotpkt2,0) - ifnull(fvalpkt2,0)) <> 0)";
        }else
        {
            $cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) <> 0";    
        }

        
    }

    $examnoStr = strtoupper($fexamno);
    $splitexamno = str_split($examnoStr);
    $examno = implode("','", $splitexamno);

    $query = "SELECT fqpcode, m.fboard, b.fboardname, fsubname, IFNULL(fspresent,0) AS fspresent,
    IFNULL(fapresent,0) AS fapresent, IFNULL(fcodecount,0) AS fcodecount,
    IFNULL(ftotpkt1,0) AS ftotpkt1, IFNULL(fvalpkt1,0) AS fvalpkt1,
    ifnull(ftotpkt2,0) as ftotpkt2, ifnull(fvalpkt2,0) as fvalpkt2,
    ifnull(ftotpkt3,0) as ftotpkt3, ifnull(fvalpkt3,0) as fvalpkt3
    FROM masqp m, control c, masboard b WHERE m.fboard=b.fboardcode AND m.fdeggrp = '{$Degree}' {$cnd1} 
    and fexamno in ('{$examno}')
    {$cnd2}
    HAVING fcodecount>0
    ORDER BY m.fboard,fqpcode";
    
    // var_dump($query);
    // die();

    $result = $aobj_context->pobj_db->GetAll($query);

    if (!$result && gettype($result) == 'boolean') {
        $arr['msg'] = "Error while fetching data";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
        return;
    }

    if (count($result) > 0) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No data found';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}


function getscriptSummary($aobj_context)
{

    $univcode = $aobj_context->mobj_data["univcode"];
    $Degree = $aobj_context->mobj_data["deggrp"];
    $fexamno = $aobj_context->mobj_data["fexamno"];
    $fboard = $aobj_context->mobj_data["fboard"];
    $status = $aobj_context->mobj_data["status"];

    if($fboard == "All"){
        $cnd = '';
    }else{
        $cnd = "AND fboard = '{$fboard}'";
    }

    // if ($status == "All") {
    //     $cnd2 = "";
    // } else if ($status == "completed") {
    //     $cnd2 = "AND fpend = 0";
    // } else if ($status == "pending") {
    //     $cnd2 = "AND fpend <> 0";
    // }

    if ($status == "All") {
        $cnd2 = "";
    } else if ($status == "completed") {
        if($Degree == 'PG')
        {
            $cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) = 0
            and (ifnull(ftotpkt2,0) - ifnull(fvalpkt2,0)) = 0";
        }else
        {
            $cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) = 0";
            
        }
        //$cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) = 0";
    } else if ($status == "pending") {

        if($Degree == 'PG')
        {
            $cnd2 = "and ((ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) <> 0
            or  (ifnull(ftotpkt2,0) - ifnull(fvalpkt2,0)) <> 0)";
        }else
        {
            $cnd2 = "and (ifnull(ftotpkt1,0) - ifnull(fvalpkt1,0)) <> 0";    
        }

        
    }


    $examnoStr = strtoupper($fexamno);
    $splitexamno = str_split($examnoStr);
    $examno = implode("','", $splitexamno);

    $query = "select m.fboard, b.fboardname, sum(ifnull(fapresent,0)) as fapresent, 
    sum(ifnull(fcodecount,0)) as fcodecount,
    if((sum(ifnull(fapresent,0)) - sum(ifnull(fcodecount,0))) < 0, 0,
    (sum(ifnull(fapresent,0)) - sum(ifnull(fcodecount,0))))  as fcodepend, 
    sum(ifnull(ftotpkt1,0)) as ftotpkt, 
    sum(ifnull(fvalpkt1,0)) as fvalpkt, 
    (sum(ifnull(ftotpkt1,0))- sum(ifnull(fvalpkt1,0)) ) as fpend,
    sum(ifnull(ftotpkt2,0)) as ftotpkt1, 
    sum(ifnull(fvalpkt2,0)) as fvalpkt1, 
    (sum(ifnull(ftotpkt2,0))- sum(ifnull(fvalpkt2,0)) ) as fpend1,
    sum(ifnull(ftotpkt3,0)) as ftotpkt3, 
    sum(ifnull(fvalpkt3,0)) as fvalpkt3, 
    (sum(ifnull(ftotpkt3,0))- sum(ifnull(fvalpkt3,0)) ) as fpend3 
    from masqp m inner join masboard b on m.fboard = b.fboardcode 
    where fexamno in ('{$examno}') and fdeggrp = '{$Degree}' {$cnd} {$cnd2}
    group by m.fboard
    having ftotpkt >0 
    order by m.fboard";
    //var_dump($query);
    $result = $aobj_context->pobj_db->GetAll($query);

    if (!$result && gettype($result) == 'boolean') {
        $arr['msg'] = "Error while fetching data";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
        return;
    }

    if (count($result) > 0) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No data found';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}



function loadboardvaluationstats($aobj_context)
{

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $Degree = $aobj_context->mobj_data["deggrp"];
    $univcode = $aobj_context->mobj_data["univcode"];
    

    $query = "select DISTINCT fboardcode, fboardname
        FROM masboard mb, masqp mq
        WHERE  mb.fboardcode=mq.fboard AND mq.fdeggrp= '{$Degree}' order by fboardcode";
    //     var_dump($query);
    // die();
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No Boards for selected University or Degree grp';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getTeachCode($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $deggrp = $aobj_context->mobj_data["deggrp"];
    $univcode = $aobj_context->mobj_data["univcode"];

    foreach($deggrp as $key => $value){
        $deg .= "'".$value."',";
    }

    $deggrp_arr = substr_replace($deg,"",-1);

    if($univcode == '051')
    {
        $query = " select distinct m.fteachcode, m.fteachname 
        from  masteach m 
        group by fteachcode";
        $result = $aobj_context->pobj_db->GetAll($query);
    }else
    {
        $query = " select distinct m.fteachcode, m.fteachname from teachsub t 
        inner join masqp q on t.fqpcode = q.fqpcode 
        inner join masteach m on t.fteachcode = m.fteachcode  
        where m.fdeggrp in({$deggrp_arr})  group by fteachcode";
        $result = $aobj_context->pobj_db->GetAll($query);
    }
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        // $arr['msg'] = 'failed to load the teachcode';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getcolList($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $deggrp = $aobj_context->mobj_data["deggrp"];
    $teachcode = $aobj_context->mobj_data["teach"];
    $univcode = $aobj_context->mobj_data["univcode"];

    foreach($deggrp as $key => $value){
        $deg .= "'".$value."',";
    }
    $deggrp_arr = substr_replace($deg, "",-1);

    foreach($teachcode as $key => $value){
        $teach .= "'".$value."',";
    }
    $teachcode_arr = substr_replace($teach, "",-1);

    
        $query = "select distinct m.fcollcode, 
        concat(c.fcollname,' - ', c.ftown)as fcollname 
        from masteach m inner join college c on 
        c.fcollcode = m.fcollcode where 
        fdeggrp in ({$deggrp_arr}) and fteachcode in({$teachcode_arr})  group by m.fcollcode;";
    
        // var_dump($query);
        // die();
    $result = $aobj_context->pobj_db->GetAll($query);
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        // $arr['msg'] = 'failed to load the college';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }


}

function getcolListfromdeggrp($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $deggrp = $aobj_context->mobj_data["deggrp"];
    $univcode = $aobj_context->mobj_data["univcode"];

    foreach($deggrp as $key => $value){
        $deg .= "'".$value."',";
    }
    $deggrp_arr = substr_replace($deg, "",-1);
    
    $query = "select distinct m.fcollcode, 
    concat(c.fcollname,' - ', c.ftown)as fcollname 
    from masteach m inner join college c on 
    c.fcollcode = m.fcollcode where 
    fdeggrp in ({$deggrp_arr})  group by m.fcollcode;";

    $result = $aobj_context->pobj_db->GetAll($query);
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        // $arr['msg'] = 'failed to load the college';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }


}

function getTeachCodeRange($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $deggrp = $aobj_context->mobj_data["deggrp"];
    $univcode = $aobj_context->mobj_data["univcode"];

    $query = " select distinct m.fteachcode, m.fteachname from teachsub t 
    inner join masqp q on t.fqpcode = q.fqpcode 
    inner join masteach m on t.fteachcode = m.fteachcode  
    where m.fdeggrp ='{$deggrp}'  group by fteachcode";

    
    $result = $aobj_context->pobj_db->GetAll($query);
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        // $arr['msg'] = 'failed to load the teachcode';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getfboarddailyval($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data["univcode"];
    $query = "select DISTINCT fboardcode, fboardname
        FROM masboard mb, masqp mq
        WHERE  mb.fboardcode=mq.fboard order by fboardcode";
    $result = $aobj_context->pobj_db->GetAll($query);
    
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No Boards for selected University or Degree grp';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getfbaordName($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data["univcode"];
    $code = $aobj_context->mobj_data["code"];

    

    $query = "select DISTINCT fboardcode, fboardname
        FROM masboard mb, masqp mq
        WHERE  mb.fboardcode=mq.fboard AND fboardcode = '{$code}'";
    $result = $aobj_context->pobj_db->GetRow($query);
    

    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No Boards for selected University or Degree grp';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getTeachCodeOnBoard($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data["univcode"];
    $board = $aobj_context->mobj_data["board"];
    $deggrp = $aobj_context->mobj_data["deggrp"];

    foreach($board as $key => $value){
        $board_a .= "'".$value."',";
    }
    $board_arr = substr_replace($board_a, "",-1);

    if($board_arr == "'all'"){
        $cnd = "fboard <> ''";
    }else{
        $cnd = "fboard in ({$board_arr})";
    }

    

    $query = "select distinct ifnull(fteachcode, '')as fteachcode, 
    ifnull(fteachname, '')as fteachname, ifnull(femail,'')as femail,
    ifnull(fmobile, '')as fmobile from masteach where $cnd and fdeggrp = '{$deggrp}'";
    $result = $aobj_context->pobj_db->GetAll($query);
    
    // var_dump($query);
    // die();
    if ($result) {
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = 'No Boards for selected University or Degree grp';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        return;
    }
}