-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.php
70 lines (56 loc) · 1.24 KB
/
index2.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
<?php
session_start();
if(!isset($_SESSION["login"])){
header("Location: login.php");
exit;
}
require 'functions.php';
$user = query("SELECT * FROM user");
//tombol cari diklik
if(isset($_POST["cari"])){
$user = cari($_POST["keyword"]);
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<a href="logout.php">Logout</a>
<h1>Daftar User</h1>
<a href="tambah.php">Tambah Data User</a>
<br></br>
<form action="" method="post">
<input type="text" name="keyword" size="30" autofocus
placeholder="masukkan keyword pencarian" autocomplete="off">
<button type="submit" name="cari">Cari</button>
</form>
<br>
<table border="1" cellpading="10" cellspacing="0">
<tr>
<th>No.</th>
<th>Aksi</th>
<th>Username</th>
<th>Password</th>
<th>NIP</th>
<th>Foto</th>
</tr>
<?php $i = 1; ?>
<?php foreach ($user as $row) : ?>
<tr>
<td><?= $i; ?></td>
<td>
<a href="ubah.php?id=<?= $row["id"]; ?>">Edit</a> |
<a href="hapus.php?id=<?= $row["id"]; ?>" onclick="
return confirm('Are You Sure to Delete This Data?');">Delete</a>
</td>
<td><?= $row["username"]; ?></td>
<td><?= $row["password"]; ?></td>
<td><?= $row["nip"]; ?></td>
<td><?= $row["foto"]; ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
</table>
</body>
</html>