-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmember.php
216 lines (203 loc) · 10.7 KB
/
member.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
include("conn_db.php");
// Initialize the session
session_start();
$selected1="JTMK";
$selected2="JKE";
$selected3="JP";
$selected4="JKM";
$selected5="";
$query=mysqli_query($conn,"select * from member");
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["admin_login"]) || $_SESSION["admin_login"] !== true){
header("location: login.php");
exit;
}
if(isset($_POST['search_btn'])){
if($_SERVER["REQUEST_METHOD"] == "POST"){
$search=strtoupper($_POST['search']);
$query=mysqli_query($conn, "select * from member where name like '%$search%'");
}
}
if(isset($_POST['program'])){
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if($_POST['program'] == ""){
$selected1="JTMK";
$selected2="JKE";
$selected3="JP";
$selected4="JKM";
$selected5="";
}
elseif($_POST['program'] == "all"){
$selected1="JTMK";
$selected2="JKE";
$selected3="JP";
$selected4="JKM";
$selected5="JKM";
}
else{
$selected1=$_POST['program'];
$selected2=$_POST['program'];
$selected3=$_POST['program'];
$selected4=$_POST['program'];
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.14/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<link href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,300;0,400;0,500;0,600;0,700;1,800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/member.css">
<title>Robotic Member Information</title>
</head>
<body>
<div class="container p-30">
<div class="row">
<div class="col-md-12 main-datatable">
<div class="card_body">
<div class="row d-flex">
<div class="col-sm-4 createSegment">
<a href="admin_to_member.php" class="btn dim_button"><span class="glyphicon glyphicon-user"></span>User Page</i></a>
<a class="btn dim_button create_new" href="member_request.php"> <span class="glyphicon glyphicon-plus"></span>Request</a>
</div>
<a class="btn" href="logout.php"> <span class="glyphicon glyphicon-log-out"></span>Logout </a>
<form method="post">
<div class="dropdown">
<select class="dropdown-select" name="program" onchange="this.form.submit();">
<option value="">Program</option>
<option value="all">All</option>
<option value="JTMK">JTMK</option>
<option value="JKE">JKE</option>
<option value="JKM">JKM</option>
<option value="JP">JP</option>
</select>
</div>
</form>
<div class="col-sm-8 add_flex">
<form action="member.php" method="post">
<div class="form-control hide_search" style="height: 10px;"></div>
<input type="text" class="text_search" placeholder="search with name" style="height: 40px;" name="search">
<input type="submit" class="button_search" value="Search" name="search_btn">
<div class="form-control hide_search" style="height: 10px;"></div>
</form>
</div>
</div>
<div class="overflow-x">
<table style="width:100%;" id="filtertable" class="table cust-datatable dataTable no-footer">
<thead>
<tr>
<th style="width:5%;">ID</th>
<th style="width:20%;">Name</th>
<th style="width:10%;">Matric No</th>
<th style="width:10%;">Program</th>
<th style="width:5%;">Sem</th>
<th style="width:10%;">Ic Number</th>
<th style="width:10%;">Tel No</th>
<th style="width:10%;">status</th>
<th style="width:10%;">Action</th>
</tr>
</thead>
<tbody>
<?php
$list=1;
while($row = mysqli_fetch_array($query)){
if($row['status'] != "" && ($row['program'] == $selected1 || $row['program'] == $selected2 || $row['program'] == $selected3 || $row['program'] == $selected4 || $row['program'] == $selected5)){
Print "<tr>";
Print '<td>'.$list."</td>";
if($row['name'] == ""){
Print '<td>'.""."</td>";
}
elseif($row['name'] != ""){
Print '<td>'.$row['name']."</td>";
}
Print '<td>'.$row['matric_no']."</td>";
if($row['program'] == ""){
Print '<td>'.""."</td>";
}
elseif($row['program'] != ""){
if($row['program'] == "JTMK"){
Print '<td><span class="mode mode_jtmk">'.$row['program']."</span></td>";
}
elseif($row['program'] == "JKM"){
Print '<td><span class="mode mode_jkm">'.$row['program']."</span></td>";
}
elseif($row['program'] == "JP"){
Print '<td><span class="mode mode_jp">'.$row['program']."</span></td>";
}
elseif($row['program'] == "JKE"){
Print '<td><span class="mode mode_jke">'.$row['program']."</span></td>";
}
}
if($row['sem'] == "0"){
Print '<td>'.""."</td>";
}
elseif($row['sem'] != ""){
Print '<td>'.$row['sem']."</td>";
}
if($row['ic_number'] == ""){
Print '<td>'.""."</td>";
}
elseif($row['ic_number'] != ""){
Print '<td>'.$row['ic_number']."</td>";
}
if($row['tel'] == ""){
Print '<td>'.""."</td>";
}
elseif($row['tel'] != ""){
Print '<td>'.$row['tel']."</td>";
}
if($row['status'] == "admin"){
Print '<td><span class="mode mode_admin">'.$row['status']."</span></td>";
}
else{
Print '<td><span class="mode mode_member">'.$row['status']."</span></td>";
}
Print '<td><div class="btn-group">
<a class="dropdown-toggle dropdown_icon" data-toggle="dropdown">
<i class="fa fa-pencil-square-o"></i> </a>
<ul class="dropdown-menu">
<li>
<a href="update_member.php?id='.$row['id'].'" >
Update Details
</a>
</li>
</ul>
</div>
<div class="btn-group">
<a class="dropdown-toggle dropdown_icon" data-toggle="dropdown">
<i class="fa fa-ellipsis-h"></i>
</a>
<ul class="dropdown-menu dropdown_more">
<li>
<a href="delete_member.php?id='.$row['id'].'">
<i class="fa fa-trash"></i> Delete
</a>
</li>
</ul>
</div></td>';
Print "</tr>";
}
$list+=1;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.14/js/jquery.dataTables.min.js"></script>
<script src="assets/js/member.js"></script>
</body>
</html>