-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathheader.php
122 lines (115 loc) · 5.86 KB
/
header.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
121
122
<nav class="blue darken2">
<div class="container">
<div class="nav-wrapper">
<a id="logo-container" href="index.php" class="brand-logo"><i class="material-icons left large">home</i>LaundryKu</a>
<ul class="right hide-on-med-and-down">
<li>
<?php
global $connect;
if ( isset($_SESSION["login-pelanggan"]) && isset($_SESSION["pelanggan"])){
// mengambil email dari session
$idPelanggan = $_SESSION["pelanggan"];
// cari data di db sesuai $email
$data = mysqli_query($connect, "SELECT * FROM pelanggan WHERE id_pelanggan = '$idPelanggan'");
// memasukkan ke array asosiatif
$data = mysqli_fetch_assoc($data);
// mengambil data nama dari array
$nama = $data["nama"];
echo "
<a href='pelanggan.php'><b>$nama</b> (Pelanggan)</a>
";
}else if ( isset($_SESSION["login-agen"]) && isset($_SESSION["agen"])){
// mengambil email dari session
$id_agen = $_SESSION["agen"];
// cari data di db sesuai $id_agen
$data = mysqli_query($connect, "SELECT * FROM agen WHERE id_agen = '$id_agen'");
// memasukkan ke array asosiatif
$data = mysqli_fetch_assoc($data);
// mengambil data nama dari array
$nama = $data["nama_laundry"];
echo "
<a href='agen.php'><b>$nama</b> (Agen)</a>
";
}else if ( isset($_SESSION["login-admin"]) && isset($_SESSION["admin"])){
echo "
<a href='admin.php'><span><b>Admin</b> (Admin)</a>
";
}else {
echo "
<a href='registrasi.php'><b>Registrasi</b></a>
";
}
?>
</li>
<li>
<?php
if ( isset($_SESSION["login-pelanggan"]) && isset($_SESSION["pelanggan"]) || isset($_SESSION["login-agen"]) && isset($_SESSION["agen"]) || isset($_SESSION["login-admin"]) && isset($_SESSION["admin"]) ){
echo "
<a href='logout.php'><b>Logout</b></a>
";
}else {
echo "
<a href='login.php'><b>Login</b></a>
";
}
?>
</li>
</ul>
<ul id="nav-mobile" class="sidenav">
<li>
<?php
if ( isset($_SESSION["login-pelanggan"]) && isset($_SESSION["pelanggan"]) || isset($_SESSION["login-agen"]) && isset($_SESSION["agen"]) || isset($_SESSION["login-admin"]) && isset($_SESSION["admin"]) ){
echo "
<a href='logout.php'><b>Logout</b></a>
";
}else {
echo "
<a href='login.php'><b>Login</b></a>
";
}
?>
</li>
<li>
<?php
global $connect;
if ( isset($_SESSION["login-pelanggan"]) && isset($_SESSION["pelanggan"])){
// mengambil email dari session
$idPelanggan = $_SESSION["pelanggan"];
// cari data di db sesuai $email
$data = mysqli_query($connect, "SELECT * FROM pelanggan WHERE id_pelanggan = '$idPelanggan'");
// memasukkan ke array asosiatif
$data = mysqli_fetch_assoc($data);
// mengambil data nama dari array
$nama = $data["nama"];
echo "
<a href='pelanggan.php'><b>$nama</b> (Pelanggan)</a>
";
}else if ( isset($_SESSION["login-agen"]) && isset($_SESSION["agen"])){
// mengambil email dari session
$id_agen = $_SESSION["agen"];
// cari data di db sesuai $id_agen
$data = mysqli_query($connect, "SELECT * FROM agen WHERE id_agen = '$id_agen'");
// memasukkan ke array asosiatif
$data = mysqli_fetch_assoc($data);
// mengambil data nama dari array
$nama = $data["nama_laundry"];
echo "
<a href='agen.php'><b>$nama</b> (Agen)</a>
";
}else if ( isset($_SESSION["login-admin"]) && isset($_SESSION["admin"])){
echo "
<a href='admin.php'><b>Admin</b> (Admin)</a>
";
}else {
echo "
<a href='registrasi.php'><b>Registrasi</b></a>
";
}
?>
</li>
</ul>
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
</div>
</div>
</nav>
<br/>