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


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/lastDateUpdate.php

<?php

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

  $req = $aobj_context->req_body['data'];
  $univcode = $aobj_context->mobj_data["univcode"];
  
  $fields="";
  $row = $req[0];

  $examnoStr = strtoupper($row['fexamrange']);
  $splitexamno =  str_split($examnoStr);
  $examno = "'".implode("','",$splitexamno)."'";
// var_dump($examno);
  switch ($row['etype']) {
    case 'Admission':
      $fields = "FADMFROM =date_format(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d'), 
        FADMTO  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%Y-%m-%d')";
      break;  
    case 'Exam Registration':
    $fields = "FAPPFROM = DATE_FORMAT(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d') , 
      FAPPTO  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%Y-%m-%d')";
      break;
    case 'Hall Ticket':
    $fields = "FHTFROM = DATE_FORMAT(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d') , 
      FHTTO  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%Y-%m-%d')";
      break;
    case 'IA Marks':
    $fields = "FIAFROM = DATE_FORMAT(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d') ,
        FIATO  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%Y-%m-%d')";
        break;
    case 'Practical Marks':
    $fields = "FPRFROM = DATE_FORMAT(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d') ,
        FPRTO  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%Y-%m-%d')";
      break;
    case 'Attendance Entry':
    $fields = "fattfrom = DATE_FORMAT('" . $row['fdatefrm'] . "','%Y-%m-%d') ,
      fattto  = DATE_FORMAT('" . $row['fdateto'] . "','%Y-%m-%d')";
      break;
    default:
      return $fields="";
  }

      
  if($row['fdegto']=='')
    $row['fdegto'] = $row['fdegfrm'];
    
  if($row['fcollto'] == '')
    $row['fcollto'] = $row['fcollfrm'];

  if($fields == ""){
    $arr['msg'] = 'Something went worng,please try after sometime.';
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
  }else{

    $query = "update collexam set $fields
    where fcollcode between '" . $row['fcollfrm'] . "' and '" . $row['fcollto'] . "' and fexamno in ($examno) 
          and fdegree in (select distinct fdegree from degree 
          where fdeggrp = '".$row['fdeggrp']."'  and 
          fdegree between '" . $row['fdegfrm'] . "' and '" . $row['fdegto'] . "')";
  }

  // var_dump($query);

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

  if($rows_affected >= 0 ){
    $msg= 'Successfully updated Dates';
    echo $aobj_context->mobj_output->ToJSONEnvelope($msg, 0,"success"); 
  }
  else{
      $arr['msg'] = 'Error While Updation.';
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
  }
}
?>