-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.php
407 lines (394 loc) · 12.9 KB
/
results.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<?php
session_start();
require_once('connection.php');
if (isset($_POST['validate']) && isset($_POST['src'])) {
$_SESSION['validate'] = FILTER_INPUT(INPUT_POST, 'validate');
$_SESSION['src'] = FILTER_INPUT(INPUT_POST, 'src');
}
if(isset($_GET['id'])){
if(isset($_SESSION['validate'])){
unset($_SESSION['validate']);
}
$id = FILTER_INPUT(INPUT_GET, 'id');
$view = $koneksi->query("SELECT * FROM `data_diri` WHERE md5(`id`) = '$id'");
$row = mysqli_fetch_array($view);
$viewmitra = $koneksi->query("SELECT * FROM `data_diri` INNER JOIN `mitra` ON `data_diri`.`id_mitra` = `mitra`.`id_mitra` WHERE md5(`id`) = '$id'");
$rowmitra = mysqli_fetch_array($viewmitra);
$nama = $row['nama'];
$usia = $row['usia'];
$jk = $row['jk'];
$email = $row['email'];
$ttlD = $row['ttlD'];
$ttlI = $row['ttlI'];
$ttlS = $row['ttlS'];
$ttlC = $row['ttlC'];
$ttllD = $row['ttllD'];
$ttllI = $row['ttllI'];
$ttllS = $row['ttllS'];
$ttllC = $row['ttllC'];
$pD = $row['pD'];
$pI = $row['pI'];
$pS = $row['pS'];
$pC = $row['pC'];
$kD = $row['kD'];
$kI = $row['kI'];
$kS = $row['kS'];
$kC = $row['sC'];
$ppD = $row['ppD'];
$ppI = $row['ppI'];
$ppS = $row['ppS'];
$ppC = $row['ppC'];
$kkD = $row['kkD'];
$kkI = $row['kkI'];
$kkS = $row['kkS'];
$kkC = $row['kkC'];
$pStar = $row['pStar'];
$kStar = $row['kStar'];
$infop = $row['infop'];
$infok = $row['infok'];
$infottl = $row['infottl'];
if(empty($row['id'])){
header("Location: 404.php");
}
}
else{
if(isset($_SESSION['id_mitra']) && isset($_SESSION['username']) && isset($_SESSION['password'])){
header("Location: mitra/responden.php");
}
elseif (isset($_SESSION['username_admin']) && isset($_SESSION['password_admin'])) {
header("Location: admin/responden.php");
}
else{
header("Location: index.php");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Hasil Tes | Admin DISC Test Griya Psikologi</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="https://griyapsikologi.com/wp-content/uploads/2018/12/logo-rsf-favicon.jpg">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="//min.gitcdn.xyz/repo/wintercounter/Protip/master/protip.min.css">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="//min.gitcdn.xyz/repo/wintercounter/Protip/master/protip.min.js"></script>
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<link rel="stylesheet" type="text/css" href="css/benten.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<body class="home page-template page-template-homepage-slider page-template-homepage-slider-php page page-id-93 logged-in admin-bar elementor-default elementor-page elementor-page-93 customize-support">
<?php
if(isset($_SESSION['username_admin']) || isset($_SESSION['username'])){
if($_SESSION['src'] === "admin"){ ?>
<nav class="navbar navbar-expand-lg bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar nav">
<li class="nav-item">
<a class="nav-link active" href="admin/responden.php"><i class="fas fa-chevron-left"></i> Kembali ke Menu Utama</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="disc-test.php?id=<?= $id ?>"><i class="fas fa-clipboard-list"></i> Lihat Jawaban</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#" onclick="printDoc()"><i class="fas fa-cloud-download-alt"></i> Unduh</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#" onclick="deleteDoc()"><i class="fas fa-trash"></i> Hapus</a>
</li>
</ul>
</nav>
<?php
}
elseif($_SESSION['src'] === "mitra"){ ?>
<nav class="navbar navbar-expand-lg bg-light">
<ul class="navbar nav">
<li class="nav-item">
<a class="nav-link active" href="mitra/responden.php"><i class="fas fa-chevron-left"></i> Kembali ke Menu Utama</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#" onclick="printDoc()"><i class="fas fa-cloud-download-alt"></i> Unduh</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#" onclick="deleteDoc()"><i class="fas fa-trash"></i> Hapus</a>
</li>
</ul>
</nav>
<?php
}
}
?>
<?php
if($row['id_mitra'] == NULL || isset($_SESSION['src'])){
?>
<div class="box-content mt-5 clearfix">
<p class="top-title">
DISC TEST</p>
<h2 class="content-title">
Hasil Tes</h2>
</div>
<table class="table table-borderless mx-auto w-75">
<tbody>
<th>
<td>Nama: <?= $nama ?></td>
<td>Usia: <?= $usia ?> th</td>
<td>Jenis Kelamin: <?= $jk ?></td>
<td>Email: <?= $email ?></td>
</th>
</tbody>
</table>
<div class="container">
<div class="row">
<div class="clearfix mx-auto w-75 col-12">
<table id="wp-calendar">
<thead>
<tr>
<th scope="col">Kepribadian</th>
<th scope="col">D</th>
<th scope="col">I</th>
<th scope="col">S</th>
<th scope="col">C</th>
<th scope="col">*</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="row">MASK/PUBLIC SELF</td>
<td><?= $pD ?></td>
<td><?= $pI ?></td>
<td><?= $pS ?></td>
<td><?= $pC ?></td>
<td><?= $pStar ?></td>
</tr>
<tr>
<td scope="row">CORE/PRIVATE SELF</td>
<td><?= $kD ?></td>
<td><?= $kI ?></td>
<td><?= $kS ?></td>
<td><?= $kC ?></td>
<td><?= $kStar ?></td>
</tr>
<tr>
<td scope="row">MIRROR/PERCEIVED SELF</td>
<td><?= $ttlD ?></td>
<td><?= $ttlI ?></td>
<td><?= $ttlS ?></td>
<td><?= $ttlC ?></td>
<td style='background-color:#eeee'></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="answer" class="my-3 clearfix mt-4 card-deck row">
<?php
$checkp = $koneksi->query("SELECT `id`, `title`, `list1`, `list2`, `list3`, `list4`, `list5`, `list6`, `list7`, `list8`, `list9`, `list10`, `list11`, `list12`, `jobs`, `paragraph` FROM `results` WHERE id = '$infop'");
$checkk = $koneksi->query("SELECT `id`, `title`, `list1`, `list2`, `list3`, `list4`, `list5`, `list6`, `list7`, `list8`, `list9`, `list10`, `list11`, `list12`, `jobs`, `paragraph` FROM `results` WHERE id = '$infok'");
$checkttl = $koneksi->query("SELECT `id`, `title`, `list1`, `list2`, `list3`, `list4`, `list5`, `list6`, `list7`, `list8`, `list9`, `list10`, `list11`, `list12`, `jobs`, `paragraph` FROM `results` WHERE id = '$infottl'");
$rowp = mysqli_fetch_array($checkp);
$rowk = mysqli_fetch_array($checkk);
$rowttl = mysqli_fetch_array($checkttl);
?>
<div class="col-md-4">
<canvas id="MaskPublicSelf"></canvas>
<script>
var ctx = document.getElementById('MaskPublicSelf').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'line',
// The data for our dataset
data: {
labels: ["D", "I", "S", "C"],
datasets: [{
label: "Mask/Public Self",
backgroundColor: 'transparent',
borderColor: '#7CB7F2',
fill: 'false',
data: [<?= $ppD ?>, <?= $ppI ?>, <?= $ppS ?>, <?= $ppC ?>],
}]
},
options: {
legend: {
display: false
}
}
});
</script>
<p id="graph3" class="line-subtext">Mask/Public Self <i class="fas fa-info-circle protip" data-pt-title="Kepribadian di muka umum" data-pt-scheme='leaf' data-pt-size='small'></i></p>
<h3 class= 'content-subtitle'><?= $rowp['title'] ?></h3>
<ul class= 'list'>
<?php
for ($list = 1; $list < 13 ; $list++) {
if (strlen(trim($rowp['list'.$list.''])) != 0){ ?>
<li><?= $rowp['list'.$list.''] ?></li>
<?php
}
}
?>
</ul>
</div>
<div class="col-md-4">
<canvas id="CorePrivateSelf"></canvas>
<script>
var ctx = document.getElementById('CorePrivateSelf').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'line',
// The data for our dataset
data: {
labels: ["D", "I", "S", "C"],
datasets: [{
label: "Core/Private Self",
backgroundColor: 'transparent',
borderColor: '#E3451E',
fill: 'false',
// data: [0, 10, 5, 2, 20, 30, 45],
data: [<?= $kkD ?>, <?= $kkI ?>, <?= $kkS ?>, <?= $kkC ?>],
}]
},
options: {
legend: {
display: false
}
}
});
</script>
<p id="graph1" class="line-subtext">Core/Private Self <i class="fas fa-info-circle protip" data-pt-title="Kepribadian saat mendapat tekanan" data-pt-scheme='leaf' data-pt-size='small'></i></p>
<h3 class= 'content-subtitle'><?= $rowk['title'] ?></h3>
<ul class= 'list'>
<?php
for ($list = 1; $list < 13 ; $list++) {
if (strlen(trim($rowk['list'.$list.''])) != 0){ ?>
<li><?= $rowk['list'.$list.''] ?></li>
<?php
}
}
?>
</ul>
</div>
<div class="col-md-4">
<canvas id="MirrorPerceivedSelf"></canvas>
<script>
var ctx = document.getElementById('MirrorPerceivedSelf').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'line',
// The data for our dataset
data: {
labels: ["D", "I", "S", "C"],
datasets: [{
label: "Mirror/Perceived Self",
backgroundColor: 'transparent',
borderColor: '#0DC143',
fill: 'false',
data: [<?= $ttllD ?>, <?= $ttllI ?>, <?= $ttllS ?>, <?= $ttllC ?>],
}]
},
options: {
legend: {
display: false
}
}
});
</script>
<p id="graph2" class="line-subtext">Mirror/Perceived Self <i class="fas fa-info-circle protip" data-pt-title="Kepribadian asli yang tersembunyi" data-pt-scheme='leaf' data-pt-size='small'></i></p>
<h3 class= 'content-subtitle'><?= $rowttl['title'] ?></h3>
<ul class= 'list'>
<?php
for ($list = 1; $list < 13 ; $list++) {
if (strlen(trim($rowttl['list'.$list.''])) != 0){ ?>
<li><?= $rowttl['list'.$list.''] ?></li>
<?php
}
}
?>
</ul>
</div>
</div>
<?php
}
?>
<?php
if(isset($_SESSION['username']) || isset($_SESSION['username_admin']) || $row['premium'] == 1 || $row['premium'] == 0){
?>
<div class="row clearfix" id="kepribadian">
<div id="paragraph" class="col-md-8">
<h3 class="content-subtitle">Deskripsi Kepribadian</h3>
<p class='text-justify'><?= $rowttl['paragraph'] ?></p>
</div>
<div id="paragraph" class="col-md-4">
<h3 class="content-subtitle">Job Match</h3>
<p><?= $rowttl['jobs'] ?></p>
</div>
</div>
<?php
}
if(!isset($_SESSION['username_admin'])){
?>
<button class="mb-4" onclick="printDoc()"><i class="fas fa-cloud-download-alt"></i> UNDUH</button>
<?php
}
if (!isset($_SESSION['username_admin']) && $row['premium'] == 1) {
?>
<div class="card mb-4 p-4" id="premium">
<div class="box-content">
<p class="top-title">
PREMIUM</p>
<h3 class="content-subtitle">HASIL ANDA PREMIUM</h3>
<p><i class="fas fa-check-circle" style="color: #56DB28; cursor: default; font-size: 8em;"></i></p>
<p>Terimakasih telah melakukan pembayaran untuk DISC Test di Griya Psikologi RSF.</p><p>Anda dapat unduh hasil tes anda disini.</p>
<button class="mb-4" onclick="printDoc()"><i class="fas fa-cloud-download-alt"></i> UNDUH</button>
</div>
</div>
<?php
}
?>
</div>
<script>
function printDoc(){
$('button,#premium').addClass('d-none');
$('.box-content').removeClass('mt-5');
if($('body').css('color','#8d8d8d')){
$(this).css('color','black');
}
window.print();
$('button,#premium').removeClass('d-none');
$('.box-content').addClass('mt-5');
}
function premium(){
var x = confirm("Pastikan pengguna sudah membayar, lanjutkan?");
if (x == true) {
<?php
$id = FILTER_INPUT(INPUT_GET, 'id');
?>
location.replace("update-premium.php?id=<?= $id ?>")
}
}
function deleteDoc(){
var x = confirm("Anda akan menghapus jawaban responden, lanjutkan?")
if (x == true) {
$id = FILTER_INPUT(INPUT_GET, 'id');
location.replace("delete.php?id=<?= $id ?>")
}
}
</script>
<script>
window.onload = function(){
var string = $("p.text-justify").text();
$("p.text-justify").html(string.replace(/[?]/gi,''));
$.protip();
}
$(document).on('contextmenu', 'img', function() {
return false;
})
</script>
</body>
</html>