-
Notifications
You must be signed in to change notification settings - Fork 17
/
aturanlanjut.php
68 lines (56 loc) · 1.72 KB
/
aturanlanjut.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
//defined('APLIKASI') or exit('Anda tidak dizinkan mengakses langsung script ini!');
$idu = dekripsi($ac);
$query = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM ujian WHERE id_ujian='$idu'"));
$idmapel = $query['id_mapel'];
$where = array(
'id_mapel' => $idmapel
);
$wherepg = array(
'id_mapel' => $idmapel,
'jenis' => '1'
);
$where2 = array(
'id_mapel' => $idmapel,
'jenis' => '2',
);
$wherelanjut = array(
'id_mapel' => $idmapel,
'id_ujian' => $idu,
'id_siswa' => $_SESSION['id_siswa']
);
$mapel = fetch($koneksi, 'ujian', array('id_mapel' => $idmapel, 'id_ujian' => $idu));
$id_acak = [];
$soalsoal = select($koneksi, 'soal', $where);
foreach ($soalsoal as $soalnya) :
$id_acak[] = $soalnya;
endforeach;
$acak = json_encode($id_acak);
$acak = enkripsi($acak);
$ujian = select($koneksi, 'ujian', array('id_mapel' => $idmapel, 'id_ujian' => $idu));
$ujianarray = [];
foreach ($ujian as $ujianya) :
$ujianarray[] = $ujianya;
endforeach;
$ujianarray = json_encode($ujianarray);
$ujianarray = enkripsi($ujianarray);
$nilai=fetch($koneksi, 'nilai',$wherelanjut);
?>
<script>
var acak = '<?= $acak ?>';
var acakpg = '<?= $nilai['id_soal'] ?>';
var ujian = '<?= $ujianarray ?>';
//if (localStorage.getItem("soallokal") === null) {
localStorage.setItem("ujianya", JSON.stringify(ujian));
localStorage.setItem("soallokal", JSON.stringify(acak));
localStorage.setItem("pengacakpg", JSON.stringify(acakpg));
//}
</script>
<?php if ($mapel['ulang'] == 1) { ?>
<script>
var acakopsi = '<?= $nilai['id_opsi'] ?>';
if (localStorage.getItem("pengacakpil") === null) {
localStorage.setItem("pengacakpil", JSON.stringify(acakopsi));
}
</script>
<?php } ?>