-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtampil_data_admin.php
120 lines (94 loc) · 4.59 KB
/
tampil_data_admin.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
session_start(); // Start session nya
// Kita cek apakah user sudah login atau belum
// Cek nya dengan cara cek apakah terdapat session username atau tidak
if( ! isset($_SESSION['username'])){ // Jika tidak ada session username berarti dia belum login
header("location: index.php"); // Kita Redirect ke halaman index.php karena belum login
}
?>
<html>
<head>
<title>Seminar IT</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<!-- <link rel="stylesheet" href="css/datatables.min.css"> -->
<!-- <link rel="stylesheet" href="datatables/lib/css/dataTables.bootstrap.min.css"> -->
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Viga" rel="stylesheet">
</head>
<body>
<h2 class="alert alert-primary text-center mt-3">Daftar Peserta Seminar</h2>
<!-- <a href="index.php" class="btn btn-sm btn-danger mb-2 ml-1">Kembali</a> -->
<!-- <a href="logout.php" class="btn btn-sm btn-danger mb-2 ml-1" onclick="return confirm('yakin?');">Logout</a>
<a href="export_excel.php" class="btn btn-sm btn-success mb-2 ml-1">Export Excel</a>
<form action="" method="post" class="form-inline mb-2 ml-1">
<input type="search" name="keyword" placeholder="cari data" class="form-control mr-1" aria-label="Search" autofocus>
<button class="btn btn-outline-primary" type="submit" name="cari" value="Search">Search</button>
</form> -->
<nav class="navbar navbar-light bg-light">
<a href="logout.php" class="btn btn-sm btn-danger mb-2 ml-0" onclick="return confirm('yakin?');">Logout</a>
<form action="" method="post" class="form-inline mb-2 ml-1">
<a href="export_excel.php" class="btn btn-md btn-success mr-2">Export Excel</a>
<input type="search" name="keyword" placeholder="cari data" class="form-control mr-1" aria-label="Search" autofocus>
<button class="btn btn-outline-primary" type="submit" name="cari" value="Search">Search</button>
</form>
</nav>
<table class="table table-bordered table-striped table-hover">
<tr>
<th>No</th>
<th>Stambuk</th>
<th>Nama Lengkap</th>
<th>Alamat</th>
<th>Jenis Kelamin</th>
<th>Email</th>
<th>No. HP</th>
<th>Angkatan</th>
<th>Kelas</th>
<th colspan="3" class="text-center">Aksi</th>
</tr>
<?php
error_reporting(0);
// Load file koneksi.php
include "koneksi.php";
$keyword = $_POST['keyword'];
if($keyword != ''){
$query = "SELECT * FROM peserta WHERE stambuk LIKE '%$keyword%' OR
nama_lengkap LIKE '%$keyword%' OR
alamat LIKE '%$keyword%' OR
jenis_kelamin LIKE '%$keyword%' OR
no_hp LIKE '%$keyword%' OR
email LIKE '%$keyword%' OR
angkatan LIKE '%$keyword%' OR
kelas LIKE '%$keyword%'
";
} else {
$query = "SELECT * FROM peserta"; // Query untuk menampilkan semua data peserta seminar
}
$sql = mysqli_query($connect, $query); // Eksekusi/Jalankan query dari variabel $query
$i = 1;
while($data = mysqli_fetch_array($sql)) {
?>
<!-- Ambil semua data dari hasil eksekusi $sql -->
<tr>
<td><?php echo $i++; ?></td>
<td><?php echo $data['stambuk']; ?></td>
<td><?php echo $data['nama_lengkap']; ?></td>
<td><?php echo $data['alamat']; ?></td>
<td><?php echo $data['jenis_kelamin']; ?></td>
<td><?php echo $data['email']; ?></td>
<td><?php echo $data['no_hp']; ?></td>
<td><?php echo $data['angkatan']; ?></td>
<td><?php echo $data['kelas']; ?></td>
<td><a href="print.php?stambuk=<?php echo $data['stambuk'] ?>" target="_BLANK" class="btn btn-sm btn-primary mb-2 ml-1">Print</a></td>
<td><a href="edit_data.php?stambuk=<?php echo $data['stambuk'] ?>" class="btn btn-sm btn-warning mb-2 ml-1">Edit</a></td>
<td><a href="proses_hapus.php?stambuk=<?php echo $data['stambuk'] ?>" onclick="return confirm('yakin?');" class="btn btn-sm btn-danger mb-2 ml-1">Hapus</a></td>
</tr>
<?php } ?>
</table>
<!-- <script src="datatables/lib/js/dataTables.bootstrap.min.js"></script> -->
<!-- <script src="js/datatables.min.js"></script> -->
<script src="js/jquery-3.3.1.slim.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>