-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusersearch.php
More file actions
265 lines (233 loc) · 12 KB
/
usersearch.php
File metadata and controls
265 lines (233 loc) · 12 KB
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?php include 'connect.php';
include_once('function.php');
$insertdata = new DB_con();
session_start();
if(!$_SESSION['name_login']){
session_destroy();
header('location:00login.php');
}
if (isset($_GET['exit'])) {
$iduser = $_SESSION['user_id'] ;
$sqlexit = mysqli_query($connect , "SELECT MAX(`id_history_in_out`) as `id_history_in_out` FROM history_in_out WHERE user_id= '$iduser' ");
$rowexit = mysqli_fetch_array($sqlexit);
$user_idexit = $rowexit['id_history_in_out'];
$sql_order_upnew = mysqli_query($connect, "UPDATE `history_in_out` SET `date_time_check-out`='$date_time' WHERE id_history_in_out = '$user_idexit' ")
or die('query failed');
session_destroy();
echo "<script>alert('คุณได้ทำการออกจากระบบเรียบร้อยแล้ว!');</script>";
header('Refresh:0; url=00login.php');
}
?>
<!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>ข้อมูลพนักงาน-ค้นหาข้อมูล</title>
<link rel="stylesheet"href="wcss/user.css">
<link rel="stylesheet"href="wcss/navber.css">
<link href='https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css' rel='stylesheet'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet">
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css"rel="stylesheet">
</head>
<body>
<div class="navber">
<div class="he">
<a style="color: #fff; text-decoration: none;" href="00tablenumber.php">ร้านก๊วยจั๊บกำลังภายใน</a>
</div>
<a href="00order.php" class="button">
<span class="content"><i class='bx bxs-dish'></i></span>
<?php
include_once('function.php');
$fetchdata = new DB_con();
$sql = $fetchdata->tostatus();
$row = mysqli_fetch_array($sql);
if($row>0){
echo '<span class="badge">'.$row['TOstatus'].'</span>';
}else{
echo '<span class="badge">0</span>';
}
?>
</a>
<?php
$user_id = $_SESSION['user_id'];
$user = mysqli_query($connect," SELECT `user_id`,`user_name`,`id_user_type` FROM `user` WHERE user_id='$user_id' " );
$row = mysqli_fetch_assoc($user);
$status = $_SESSION['status_login'] ;
$user_type = mysqli_query($connect," SELECT * FROM `user_type` WHERE id_user_type='$status' " );
$rowuser_type = mysqli_fetch_assoc($user_type)
?>
<button class="myBtn2" id="myBtn10" onclick="myFunctionmyBtn()">
<p class="co"><?php echo $rowuser_type['user_type']?></p>
<div class="profile-photo" >
<i class='bx bxs-face'></i>
<!-- <img src="https://i.pinimg.com/736x/36/7c/39/367c393354fecb4918b2bee5795ae290.jpg" > -->
</div>
</button>
<div id="id01" class="modalid01">
<div class="modal__content">
<div class="modal-header">
<p><?php echo $rowuser_type['user_type']?></p>
<button class="dark" onclick="myFunctiondark()"><span class="material-icons"><span class="material-icons">settings_brightness</span></button>
</div>
<div class="modal-body">
<a class="a" type="submit" href="00user.php?exit" >
<span class="material-icons">logout</span>
<p>ออกจากระบบ</p>
<i class='bx bx-chevron-right'></i>
</a>
</div>
</div>
</div>
</div><!-- end navber -->
<div class="home-section">
<!-- <div class="menubox">
<div class="menu0">
<div class="a1">w</div>
<div class="a1">w</div>
<div class="a1">w</div>
<div class="a1">w</div>
</div>-->
<div class="menu">
<div class="nav-list">
<div class="menubox">
<div class="b1"></div>
<div class="a1">
<a href="00tablenumber.php">
<i class='bx bx-store' ></i>
<span class="links_name">หน้าหลัก</span>
</a>
</div>
</div>
<div class="menubox">
<div class="b2"></div>
<div class="a2">
<a href="00food.php">
<i class='bx bx-food-menu' ></i>
<span class="links_name">เมนูอาหาร</span>
</a>
</div>
</div>
<div class="menubox">
<div class="b3"></div>
<div class="a3">
<a href="00report.php">
<i class='bx bx-chart'></i>
<span class="links_name">รายงาน</span>
</a>
</div>
</div>
<!--
<div class="menubox">
<div class="b4"></div>
<div class="a4">
<a href="#">
<i class='bx bx-pie-chart-alt-2'></i>
<span class="links_name">Dashboard</span>
</a>
</div>
</div>
-->
<div class="menubox">
<div class="b5"></div>
<div class="a5">
<a href="00user.php">
<i class='bx bx-user'></i>
<span class="links_name">ข้อมูลผู้ใช้ระบบ</span>
</a>
</div>
</div>
<div>
</div>
</div>
</div>
<div class="box">
<ul class="breadcrumb">
<li><a href="00user.php">ข้อมูลผู้ใช้ระบบ</a></li>
<li>ค้นหาข้อมูลพนักงาน</li>
</ul>
<div class="boxuser">
<div class="danger">
ค้นหาข้อมูลพนักงาน
</div>
<div class="tapSS">
<form class="tapo" action="<?=$_SERVER['PHP_SELF'];?>" method="post" >
<input type="text" id="fname" name="search" placeholder="ชื่อผู้ใช้ ">
<button type="submit" name="button" id="button" ><span class="material-icons">search</span></button>
</form>
</div>
<table>
<tr>
<!-- <th style="width:3% ; text-align: center;"><input type="checkbox" class="form-check-input" id="select_all"></th> -->
<th style="width:3%; text-align:center;">#</th>
<th style="width:10%;" >รหัสผู้ใช้</th>
<!-- <th style="width:5% ; text-align: center;">รูป</th> -->
<th style="width:20%;">ชื่อผู้ใช้</th>
<th style="width:10%;">ประเภทผู้ใช้งาน</th>
<th style="width:10%;">เบอร์โทรศัพท์</th>
<th style="width:20%;">วันที่เพิ่มบัญชี</th>
<th style="width:10%" ></th>
</tr>
<?php
isset( $_POST['search'] ) ? $search = $_POST['search'] : $search = "";
$num = 0 ;
if( !empty( $search ) ) {
$sql = "SELECT * FROM `user` WHERE `user_name` LIKE '%$search%' or `phone` LIKE '%$search%' ";
$numrow = mysqli_query( $connect, $sql );
while($rowsearch = mysqli_fetch_assoc($numrow) ) {
$num = $num + 1 ;
?>
<tr>
<td style="text-align:center;"><?php echo $num ?></td>
<td><?php echo $rowsearch['user_id'] ?></td>
<td><?php echo $rowsearch['user_name'] ?></td>
<?php
if($row["id_user_type"]==1){
?>
<td>เจ้าของร้าน</td>
<?php }else{ ?>
<td>พนักงาน</td>
<?php } ?>
<td><?php echo $rowsearch["phone"];?></td>
<?php
if($rowsearch["useredit"]==0){
?>
<td><?php echo $rowsearch["date_added"];?></td>
<?php }else{ ?>
<td><?php echo $rowsearch["date_added"]."      "."[ แก้ไขล่าสุด ]";?></td>
<?php } ?>
<td class=btnA style=" text-align:center;">
<a class="btntd edit" name="edit" href="useredit.php?user_id=<?=$row["user_id"]?>" ><i class='bx bxs-edit-alt' ></i></a>
<a class="btntd delete" name="del_user" type="submit" onclick="Del(this.href); return false;" href="00user.php?del_user=<?php echo $row['user_id']; ?>"><i class='bx bxs-trash-alt'></i></a>
</td>
</tr>
<?php }
mysqli_close( $connect );
}else{
?>
<tr>
<td colspan="8" ><p class="nodata">ไม่มีข้อมูล<p></td>
</tr>
<?php } ?>
</table>
</div>
</div>
<script>
function myFunctionmyBtn() {
var modalid01 = document.getElementById('id01');
var btn = document.getElementById("myBtn10");
// When the user clicks anywhere outside of the modal, close it
btn.onclick = function() {
modalid01.style.display = "block";
}
window.onclick = function(event) {
if (event.target == modalid01) {
modalid01.style.display = "none";
}
}
}
</script>
</body>
</html>