-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
106 lines (88 loc) · 2.78 KB
/
index.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
<?php
session_start();
if( !isset($_SESSION["login"]) ) {
header("Location: login.php");
exit;
}
require 'functions.php';
$mahasiswa = query("SELECT * FROM mahasiswa");
// jika tombol cari ditekan
if( isset($_POST["cari"]) ) {
$mahasiswa = cari($_POST["keyword"]);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Halaman Admin</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<style>
.loader {
width: 100px;
position: absolute;
top: 118px;
left: 335px;
z-index: -1;
display: none;
}
@media print{
.logout, .tambah, .form-cari, .aksi{
display: none;
}
}
</style>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="logout.php"><span class="glyphicon glyphicon-log-out"></span>>Logout</a>
</li>
</ul>
<h1>Daftar Mahasiswa</h1>
<a href="tambah.php" class="btn btn-primary btn-sm">Tambah data mahasiswa</a>
<br><br>
<form action="" method="post" class="form-cari">
<input type="text" name="keyword" size="40" autofocus placeholder="masukkan keyword pencarian.." autocomplete="off"
id ="keyword">
<button type="submit" name="cari" id="tombol-cari">Cari</button>
<img src="img/loader.gif" class="loader">
</form>
<br>
<div id="container">
<table class="table table-bordered table-striped">
<tr>
<th>No.</th>
<th class="aksi">Aksi</th>
<th>Gambar</th>
<th>Nim</th>
<th>Nama</th>
<th>Email</th>
<th>Jurusan</th>
</tr>
<?php $i = 1; ?>
<?php foreach( $mahasiswa as $row ) : ?>
<tr>
<td><?= $i; ?></td>
<td class="aksi">
<a href="ubah.php?id="<?php echo $row["id"]; ?>>Ubah</a> |
<a href="hapus.php?id=<?php echo $row["id"]; ?>" onclick="return confirm('yakin?');">Hapus</a>
</td>
<td><img src="img/<?php echo $row["gambar"]; ?>" width="50"></td>
<td><?= $row["nim"]; ?></td>
<td><?= $row["nama"]; ?></td>
<td><?= $row["email"]; ?></td>
<td><?= $row["jurusan"]; ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
</table>
</div>
</body>
</html>