-
Notifications
You must be signed in to change notification settings - Fork 17
/
syncsoal.php
39 lines (38 loc) · 1.18 KB
/
syncsoal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require("config/config.default.php");
require("config/config.function.php");
$token = isset($_GET['token']) ? $_GET['token'] : 'false';
$querys = mysqli_query($koneksi, "select token_api from setting where token_api='$token'");
$cektoken = mysqli_num_rows($querys);
if ($cektoken <> 0) {
$querybank = mysqli_query($koneksi, "select * from mapel ");
$array_bank = array();
while ($bank = mysqli_fetch_assoc($querybank)) {
$array_bank[] = $bank;
}
$querysoal = mysqli_query($koneksi, "select * from soal ");
$array_soal = array();
while ($soalx = mysqli_fetch_assoc($querysoal)) {
$array_soal[] = $soalx;
}
$queryjadwal = mysqli_query($koneksi, "select * from ujian");
$array_jadwal = array();
while ($jadwal = mysqli_fetch_assoc($queryjadwal)) {
$array_jadwal[] = $jadwal;
}
$queryfile = mysqli_query($koneksi, "select * from file_pendukung");
$array_file = array();
while ($file = mysqli_fetch_assoc($queryfile)) {
$array_file[] = $file;
}
echo json_encode(
[
"bank" => $array_bank,
"soal" => $array_soal,
"jadwal" => $array_jadwal,
"file" => $array_file
]
);
} else {
echo "<script>location.href='.'</script>";
}