-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
executable file
·147 lines (143 loc) · 4.11 KB
/
admin.php
File metadata and controls
executable file
·147 lines (143 loc) · 4.11 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
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
<?php
session_start();
require('asset/mysql_con.php');
require('asset/login_cek.php');
$date = date("l d-M-Y");
$q = mysqli_query($link, "select * from db_id where user='catur'");
$query = mysqli_query($link, "select * from db_content");
?>
<html>
<head>
<title> Admin Management </title>
</head>
<body>
<h2> Admin Panel v1
<div style="clear: left; float: right;"><a href="logout.php" style="text-decoration: none">Logout</a></div></h2>
<a href="index.php" target="_blank">View web </a>
<p> <strong>Login as</strong> <?php echo $_SESSION['username']; ?></p>
<p><?php echo $date; ?> </p>
<table cellspacing="3" cellpadding="2" border="1">
<form action="add_content.php" method="post">
<thead>
<th colspan="2"> Add Content </h3></th>
</thead>
<tr>
<td> Judul </td>
<td><input style="width: 500px" type="text" name="judul" required/></td>
</tr>
<tr>
<td> Nama Penulis </td>
<td><input style="width: 500px" type="text" name="user" required /></td>
</tr>
<tr>
<td> Category </td>
<td><select style="width: 200px" name="category">
<option>Programming</option>
<option>Physics</option>
<option>Anime</option>
</select>
</td>
<tr>
</tr>
<tr>
<td colspan="2"><textarea cols="5" rows="8" style="width:850px; height:380px" name="isi" required >
</textarea>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Selesai" /></td>
</tr>
</form>
</table>
<?php
if($_GET['value'] == 'success'){
echo "<p><strong>Data berhasil ditambahkan! </strong></p>";
} else if($_GET['value'] == 'hapus'){
echo "<p><strong>Data berhasil dihapus! </strong></p>";
} else if ($_GET['value'] == 'edit'){
echo "<p><strong>Data berhasil diedit!</strong></p>";
}
?>
<br />
<table cellspacing="5" cellpadding="3" width="850px" border="1">
<thead>
<th colspan="5">List Content</th>
</thead>
<tr>
<td>
<?php
while($q = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$judul = $q['judul'];
$id = $q['id'];
$isi = $q['isi'];
$tanggal = $q['tanggal'];
$user = $q['user'];
?>
<table>
<tr>
<td>Judul : <?php echo $judul; ?> </td>
<td> </td>
<td>Di posting oleh : <?php echo $user; ?> </td>
<td> </td>
<td><?php echo $tanggal; ?></td>
</tr>
<tr>
<td colspan="5"><hr></td>
</tr>
<tr>
<td colspan="5" ><p><?php echo $isi; ?></p></td>
</tr>
<tr>
<td><a href="edit_content.php?id=<?php echo $id;?>">Edit</a> || <a href="hapus_content.php?id=<?php echo $id;?>">Hapus</a></td>
<br />
<br />
</tr>
</table>
<?php
}
?>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="3" width="850px" border="1" style="margin-top: 40px">
<thead>
<th>User Management</th>
</thead>
<tr>
<td>
<table cellspacing="7" align="center">
<thead>
<th>User ID </th>
<th>User Name </th>
<th>Password </th>
<th>E-mail </th>
<th>Jabatan</th>
<th>Opsi </th>
<th><a href="privilege_cek.php?action=tambah" style="color: #2A5DB0; text-decoration: none; font-size: 30px">+</a></th>
</thead>
<?php
$query = mysqli_query($link, "select * from db_id order by id asc");
while($q = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$id = $q['id'];
$username = $q['user'];
$password = $q['password'];
$email = $q['email'];
$privilege = $q['privilege'];
?>
<tr>
<td style="text-align: center"><?php echo $id; ?></td>
<td style="text-align: center"><?php echo $username; ?> </td>
<td style="text-align: center"><?php echo md5($password); ?></td>
<td style="text-align: center"><?php echo $email; ?> </td>
<td style="text-align: center"><?php echo $privilege; ?> </td>
<td style="text-align: center"><a href="privilege_cek.php?action=edit&userid=<?php echo $id; ?>">Edit</a> || <a href="privilege_cek.php?action=hapus&userid=<?php echo $id; ?>">Hapus</a></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>