-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaster.php
69 lines (69 loc) · 1.92 KB
/
master.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
<?php
// Request session
// ilhamepri
if( empty( $_SESSION['iduser'] ) ){
$_SESSION['err'] = '<strong>ERROR!</strong> Anda harus login terlebih dahulu.';
header('Location: ./');
die();
}else {
// Request Item Menu
// ilhamepri
if( isset( $_REQUEST['sub'] )){
$sub = $_REQUEST['sub'];
switch($sub){
case 'barang':
include 'barang.php';
break;
case 'merk':
include 'merk.php';
break;
case 'kelompok':
include 'kelompok.php';
break;
}
}else {
// Request User Menu
// ilhamepri
if(isset($_REQUEST['aksi'])){
$aksi = $_REQUEST['aksi'];
switch($aksi){
case 'baru':
include 'user_baru.php';
break;
case 'edit':
include 'user_edit.php';
break;
case 'hapus':
include 'user_hapus.php';
break;
}
}else {
echo '<h2>Daftar User</h2><hr>';
// Query ambil user
// ilhamepri
$sql = mysql_query("SELECT iduser,username,admin,fullname FROM user ORDER BY iduser");
$no = 1;
echo '<div class="row">';
echo '<div class="col-md-6">';
echo '<table class="table table-bordered">';
echo '<tr class="info"><th width="30">No.</th><th>Username</th><th>Nama Lengkap</th><th width="50">Admin</th>';
echo '<th><a href="admin.php?hlm=master&aksi=baru" class="btn btn-default btn-xs">Tambah</a></th></tr>';
// Loop Daftar User
// ilhamepri
while(list($id,$username,$admin,$fullname) = mysql_fetch_array($sql)){
echo '<tr><td>'.$no.'</td>';
echo '<td>'.$username.'</td>';
echo '<td>'.$fullname.'</td>';
echo '<td>';
echo ($admin == 1) ? '<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>' : '';
echo '</td>';
echo '<td><a href="admin.php?hlm=master&aksi=edit&id='.$id.'" class="btn btn-success btn-xs">Edit</a> ';
echo '<a href="admin.php?hlm=master&aksi=hapus&id='.$id.'" class="btn btn-danger btn-xs">Hapus</a></td></tr>';
$no++;
}
echo '</table>';
echo '</div></div>';
}
}
}
?>