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


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

<?php
include("error_log.php");
function getMarksEntryDet($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $univcode = $aobj_context->mobj_data['univcode'];

  $type = $aobj_context->mobj_data['type'];
  $status = $aobj_context->mobj_data['status'];

  if($status == "Pending"){
      $cnd = "and ifnull(m.fstatus,'F') <> 'T'";
  }else if($status == "Updated"){
    $cnd = "and ifnull(m.fstatus,'F') = 'T'";
  }else{
    $cnd = "";
  }
  
   $query="select ifnull(c.fdocpath,'') as fdocpath,ifnull(c.fremarks,'') as fremarks,ifnull(m.fdocno,'') as fdocno , count(m.fdocno) as cnt,
   ifnull(date_format(c.fdate,'%d/%m/%Y') , '') as fdate
    from modmarks m
    inner join corrdoc c on m.fdocno = c.fid
    where c.ftype = '{$type}' $cnd
    group by c.fdocpath";

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

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

function updatemarksentry($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $docno = $aobj_context->mobj_data['docno'];
    $status = $aobj_context->mobj_data['status'];


    if($status == "Pending"){
        $cnd = "and ifnull(m.fstatus,'F') <> 'T'";
    }else if($status == "Updated"){
        $cnd = "and ifnull(m.fstatus,'F') = 'T'";
    }else{
      $cnd = "";
    }
    

     $query="select ifnull(m.fregno,'') as fregno,ifnull(m.fsubcode,'') as fsubcode,ifnull(m.fvalno,'') as fvalno,
     ifnull(m.fmarks12,'') as fmarks12,ifnull(m.fstatus,'') as fstatus,ifnull(c.fdocpath,'') as fdocpath
     from modmarks m inner join corrdoc c on c.fid = m.fdocno
     where c.fid = '{$docno}' $cnd";

  
       $result = $aobj_context->pobj_db->GetAll($query);
  
    if($result){
      echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
    }
    else{
      $arr['msg']="Failed to Load";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    }
  }


  function savemarksentry($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $mobileno = $aobj_context->mobj_data['mobileno'];
    $docno = $aobj_context->mobj_data['docno'];
    
    $req = $aobj_context->req_body;

    $data = $req['tabarr'];


    foreach($data as $key => $val){
      $qry = "select ifnull(fmarks11,'') as fmarks11,ifnull(fmarks12,'') as fmarks12
      from modmarks 
      where fregno = '{$val['fregno']}' and fsubcode = '{$val['fsubcode']}' and fdocno = '{$docno}'";
      
      $res = $aobj_context->pobj_db->GetRow($qry);
      
      $oldmarks =  $res['fmarks12'];
      $enttype = "MM";
      $usr = $mobileno;
      $mob = $mobileno;
      $college_code = $val['fregno'];
      $remark = "MM - Marks Modification User: $mobileno, ".$val['fregno']." Oldmarks : $oldmarks,Newmarks : ".$val['fmarks12'];      $res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);

        $query = "update modmarks set fmarks12 = '{$val['fmarks12']}',fmoduser = '{$mobileno}',
        fmoddate = now(),fstatus = 'T'
        where fregno = '{$val['fregno']}' and fsubcode = '{$val['fsubcode']}' 
        and fdocno = '{$docno}' and fvalno = '{$val['fvalno']}'";

        $result = $aobj_context->pobj_db->Execute($query);
    }

   
  
    if($result){
        $arr['msg'] = "Updated Successfully....!";
      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 checkfmarks($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $fmarks12 = $aobj_context->mobj_data['fmarks'];
    $req = $aobj_context->req_body;
    $data = $req['regno'];
    $regno = $data['fregno'];
    $subcode = $data['fsubcode'];
    $fmarks12 = $data['fmarks12'];

    // var_dump($regno);
    // die();


    $query = "select ifnull(fmarks11,'') as fmarks11 from
    modmarks where fregno = '{$regno}' and fsubcode = '{$subcode}'";

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

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



    $fmarks11 = $result['fmarks11'];

    if($fmarks12 == $fmarks11 || $fmarks12 == -5){
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
    }else{
        $arr['msg']="marks did not match ";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    }


   
  }


?>