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


Current Path : /var/www/html/admission/src/
Upload File :
Current File : /var/www/html/admission/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];

  // var_dump($row['fdeggrp']);
  // die();

  $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(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d') ,
        fattto  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%Y-%m-%d')";
      break;
    case 'Room Allotment':
      $fields = "frafrom = DATE_FORMAT(str_to_date('" . $row['fdatefrm'] . "','%d/%m/%Y'),'%Y-%m-%d') ,
        frato  = DATE_FORMAT(str_to_date('" . $row['fdateto'] . "','%d/%m/%Y'),'%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);
die();
  $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");
  }
}

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

  $query = "select distinct c.fcollcode, c.fcollname,c.ftown, dg.fdeggrp from college c 
  inner join student s on s.fcollcode = c.fcollcode 
  inner join degree d on d.fdegree = s.fdegree 
  inner join deggrp dg on d.fdeggrp = dg.fdeggrp 
  where dg.fdeggrp ='{$deggrp}' order by fcollcode";

  $result=$aobj_context->pobj_db->GetAll($query);
  
    if($result){
      echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
    }
    else{
      $arr['msg']="Please try later";
      echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
    }
}
?>