-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_see_detail.php
40 lines (33 loc) · 1.47 KB
/
admin_see_detail.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
<?php
include 'connect.php';
header('Content-type: application/json');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = $_POST['email'];
$sql = "SELECT email,
nama,
hp,
FLOOR(DATEDIFF(NOW(),lahir)/365.25) as umur,
ketua,
group_member
FROM user
WHERE email = ? AND email != '[email protected]'";
$stmt = $pdo->prepare($sql);
$stmt->execute([$email]);
$data = $stmt->fetch();
// Kalau dia Ketua tidak usah menampilkan apakah dia group member atau bukan
$status = '';
if ($data['ketua'] === 0) {
$status = $data['group_member'] ? 'Sudah Masuk Dalam Group' : 'Belum Masuk Dalam Group';
$status = '<tr><td><b>Status Group</b></td> <td>' . $status . '</td></tr>';
}
$jabatan = $data['ketua'] ? 'Ketua Group' : 'Member Group';
$output = '<table class="table table-borderless">
<tr><td><b>Nama</b></td><td>' . $data['nama'] . '</td></tr>
<tr><td><b>Email</b></td> <td>' . $data['email'] . '</td></tr>
<tr><td><b>No HP</b></td> <td>' . $data['hp'] . '</td></tr>
<tr><td><b>Umur</b></td> <td>' . $data['umur'] . '</td></tr>
<tr><td><b>Jabatan</b></td> <td>' . $jabatan . '</td></tr>
' . $status . '
</table>';
echo json_encode(array('output' => $output));
}