Guest User

Untitled

a guest
Nov 22nd, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. include_once '../function/core.php';
  3.  
  4. $q = anti_inject(@$_GET['q']);
  5.  
  6. if ($q == "kls") {
  7.  
  8.     $paket = anti_inject($_POST['paket']);
  9.  
  10.     $selectjur = select('*', 'tbl_kelas', "paket = '$paket'");
  11.     $jurusan = array();
  12.     while ($j = mysqli_fetch_object($selectjur)) :
  13.         $jurusan[] = $j;
  14.     endwhile;
  15.  
  16.     echo json_encode($jurusan);
  17.  
  18. } else if($q == "mpl") {
  19.  
  20.     $kelas = anti_inject($_POST['kelas']);
  21.     $kelas = substr($kelas, 0,2);
  22.  
  23.     if ($kelas == 10) {
  24.  
  25.         $sqlkls = select("*", "tbl_mapel", "kelas = 10");
  26.  
  27.     } else if($kelas == 11) {
  28.  
  29.         $sqlkls = select("*", "tbl_mapel", "kelas = 11");
  30.  
  31.     } else if($kelas == 12) {
  32.  
  33.         $sqlkls = select("*", "tbl_mapel", "kelas = 12");
  34.  
  35.     }
  36.  
  37.     $class = array();
  38.     while ($c = mysqli_fetch_object($sqlkls)) {
  39.         $class[] = $c;
  40.     }
  41.  
  42.     echo json_encode($class);
  43.  
  44. }
  45. ?>
Add Comment
Please, Sign In to add comment