Untitled
unknown
plain_text
7 months ago
2.5 kB
1
Indexable
Never
<?php require('connect.php'); require('periksa.php'); if($_GET['category'] == 'single'){ $dts = $_POST['single_date']; $sth = mysqli_query($conn, "SELECT pos.*,users.* FROM pos JOIN users ON pos.penanggung_jawab = users.username WHERE pos.tgl_pos='$dts' GROUP BY pos.nopol ORDER BY pos.tgl_pos ASC"); if(mysqli_num_rows($sth)){ while ($data = mysqli_fetch_assoc($sth)) { $msg[] = array("category" => 'pos_single', "tgl_pos" => $data['tgl_pos'], "admin" => $data['nama'], "nopol" => $data['nopol'], "lajur" => $data['lajur']); } $json = $msg; header('content-type: application/json'); echo json_encode($json); } else { $msg = array("null" => true); $json = $msg; header('content-type: application/json'); echo json_encode($json); } } else if($_GET['category'] == 'multiple'){ $start = $_POST['start']; $end = $_POST['end']; $sab = mysqli_query($conn, "SELECT pos.*,users.* FROM pos JOIN users ON pos.penanggung_jawab = users.username WHERE pos.tgl_pos BETWEEN '$start' AND '$end' GROUP BY pos.nopol ORDER BY pos.tgl_pos ASC"); if(mysqli_num_rows($sab)){ while ($data = mysqli_fetch_assoc($sab)) { $msg[] = array("category" => 'pos_single', "tgl_pos" => $data['tgl_pos'], "admin" => $data['nama'], "nopol" => $data['nopol'], "lajur" => $data['lajur']); } $json = $msg; header('content-type: application/json'); echo json_encode($json); } else { $msg = array("null" => true); $json = $msg; header('content-type: application/json'); echo json_encode($json); } } else if($_GET['category'] == 'detail'){ $dp = $_POST['nopol']; $sth = mysqli_query($conn, "SELECT * FROM pos WHERE nopol='$dp'"); if(mysqli_num_rows($sth)){ while ($data = mysqli_fetch_assoc($sth)) { $pgn; if($data['penanggung_jawab'] == 'admin'){ $pgn = 'Admin UM'; } else { $pgn = $data['penanggung_jawab']; } $msg[] = array("category" => 'pos_detail', "tipe_uji" => $data['tipe_uji'], "admin" => $pgn, "kendala" => $data['kendala'], "waktu_uji" => $data['waktu_uji']); } $json = $msg; header('content-type: application/json'); echo json_encode($json); } else { $msg = array("null" => true); $json = $msg; header('content-type: application/json'); echo json_encode($json); } } ?>