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


Current Path : /var/www/html/studentportal_wait/src/
Upload File :
Current File : /var/www/html/studentportal_wait/src/oldQPDownload.php

<?php

include("database.php");
include("commandb.php");

if($_REQUEST['action'] == 'getExmname'){


  $qry = "select distinct d.fexamno, fexamname from qparc a inner join subject s on a.fqpcode = s.fqpcode
  inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
  where s.ftheory = 'T' and s.fdegree = '{$_SESSION['DEGREE']}'";
  // var_dump($qry);
  $result = mysqli_query($conn,$qry);
  $count = mysqli_num_rows($result);
  
  if($count>0){
    $arr=array();

    while($row = mysqli_fetch_assoc($result)){

      array_push($arr,$row);

    }
    $data['data']=$arr;
    $data['status']="success";
    $data['error_code']=0;
    echo json_encode($data);
  }else{
    $data['data']="No Data";
    $data['status']="failure";
    $data['error_code']=1;
    echo json_encode($data);
  }
  
}
else if($_REQUEST['action'] == 'getExamDate'){

  $fexamname= $_REQUEST['fexmname'];

  $query="select distinct a.fexamdate from qparc a inner join subject s on a.fqpcode = s.fqpcode
  inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
  where s.ftheory = 'T' and s.fdegree = '{$_SESSION['DEGREE']}' and s.fexamno = '{$fexamname}'";

  // var_dump($query);
  $result = mysqli_query($conn,$query);
  $count = mysqli_num_rows($result);
  // $row = mysqli_fetch_assoc($result);
  
  if($count>0){
    $arr=array();

    while($row = mysqli_fetch_assoc($result)){

      array_push($arr,$row);

    }
    $data['data']=$arr;
    $data['status']="success";
    $data['error_code']=0;
    echo json_encode($data);
  }else{
    $data['data']="No Data";
    $data['status']="failure";
    $data['error_code']=1;
    echo json_encode($data);
  }
}
else if($_REQUEST['action']=='getOldQP'){
 
  $fexamname= $_REQUEST['fexmname'];
  $fexmdate= $_REQUEST['fexmdate'];

  $query="select distinct s.fsubname,q.fexamdate,q.ffilename from subject s
  inner join degree d on d.fdegree=s.fdegree and d.fexamno = s.fexamno
  inner join qparc q on q.fqpcode=s.fqpcode 
  where s.fexamno='{$fexamname}' and d.fdegree='{$_SESSION['DEGREE']}' and q.fexamdate='{$fexmdate}'";
  $result = mysqli_query($conn,$query);
  $count = mysqli_num_rows($result);
  // $row = mysqli_fetch_assoc($result);
  // var_dump($row);
  if($count>0){
    
    $final_data = array();
    $arr=array();

    $path = realpath(__DIR__ . '/..').DIRECTORY_SEPARATOR.'qparchive'.DIRECTORY_SEPARATOR;

    // var_dump($path);

    while($row = mysqli_fetch_assoc($result)){

      if(file_exists($path.$row['ffilename']))
        array_push($final_data,$row);

    }

    $data['data']=$final_data;
    $data['status']="success";
    $data['error_code']=0;
    echo json_encode($data);

  }else{
    $data['data']="No Data";
    $data['status']="failure";
    $data['error_code']=1;
    echo json_encode($data);
  }
}

?>