-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
110 lines (98 loc) · 2.92 KB
/
Copy pathview.php
File metadata and controls
110 lines (98 loc) · 2.92 KB
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
<?php
include 'functions.php';
session_start();
if (!isset($_SESSION['loggedin'])) {
header('Location: login.php');
exit;
}
if (!$_SESSION['su']) {
$_SESSION['msg'] = 'Sorry, hanya admin yang bisa akses page ini';
header('Location: index.php');
exit;
}
$msg = "";
if (isset($_SESSION['msg'])) {
$msg = $_SESSION['msg'];
$_SESSION['msg'] = "";
}
$pdo = pdo_connect_mysql();
if (!isset($_GET['id'])) {
exit('No ID specified!');
}
$stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?');
$stmt->execute([$_GET['id']]);
$user = $stmt->fetch();
$get_polls = $pdo->prepare('SELECT * FROM polls WHERE creator_id = ?');
$get_polls->execute([$_GET['id']]);
$polls = $get_polls->fetchAll(PDO::FETCH_ASSOC);
?>
<?=template_header('View')?>
<div class="container-fluid content home">
<h2><i class="fa fa-file-alt fa-lg" style="margin-right: 10px"></i>Report</h2>
<div>
<p>Account details are below:</p>
<table class="table table-bordered">
<tr>
<td scope="col">Nama Lengkap:</td>
<td><?=$user['name']?></td>
</tr>
<tr>
<td scope="col">NPM:</td>
<td><?=$user['npm']?></td>
</tr>
<tr>
<td scope="col">Prodi:</td>
<td><?=$user['prodi']?></td>
</tr>
<tr>
<td scope="col">Username:</td>
<td><?=$user['username']?></td>
</tr>
<tr>
<td scope="col">Email:</td>
<td><?=$user['email']?></td>
</tr>
<tr>
<td scope="col">IP address:</td>
<td><?=$user['ip']?></td>
</tr>
</table>
</div>
<div>
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<td scope="col">#</td>
<td scope="col">Title</td>
<td scope="col">Description</td>
<td scope="col">Action</td>
</tr>
</thead>
<tbody>
<?php $num = 1; ?>
<?php foreach ($polls as $poll): ?>
<?php
if ($poll['desc'] == '') {
$poll['desc'] = 'No description';
}
?>
<tr>
<th scope="row"><?=$num?></td>
<td><?=$poll['title']?></td>
<td><?=$poll['desc']?></td>
<td class="actions">
<a href="vote.php?id=<?=$poll['id']?>" class="view" title="View Poll"><i class="fas fa-eye fa-xs"></i></a>
<?php
if ($_SESSION['id'] == $poll['creator_id'] || $_SESSION['su']) {
echo '<a href="delete.php?id=' . $poll['id'] . '" class="trash" title="Delete Poll"><i class="fas fa-trash fa-xs"></i></a>';
}
?>
</td>
</tr>
<?php $num++; ?>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
<?=template_footer()?>