-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanageusers.php
387 lines (327 loc) · 22.1 KB
/
manageusers.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
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<?php
// session_start();
// require "connection.php";
// if (isset($_SESSION["a"])) {
?>
<!DOCTYPE html>
<html>
<head>
<title>AdiMobile | Admin | Manage Users</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="resources/mylogo.png" />
<link rel="stylesheet" href="bootstrap.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link rel="stylesheet" href="style.css" />
</head>
<body class="mainbackground">
<div class="container-fluid">
<div class="row">
<div class="col-12 mb-0">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="adminpanel.php">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Manage Users</li>
</ol>
</nav>
</div>
<div class="col-12 mb-2">
<label class="form-label fs-2 fw-bold text-primary">Manage All Users</label>
<!-- <hr /> -->
</div>
<div class="bg-primary col-12" style="height: 10px;"></div>
<div class="col-12 rounded mt-3">
<div class="row">
<div class="mx-auto col-12 col-lg-8 mb-3">
<div class="row">
<div class="col-9 mx-auto">
<input type="text" class="form-control fw-bold" placeholder="Search user email here..." id="searchtxt" onkeyup="searchUser1();" />
</div>
<!-- <div class="col-3 d- d-grid">
<button class="btn btn-primary" onclick="searchUser1();">Search</button>
</div> -->
</div>
</div>
</div>
</div>
<!-- <div class="col-12 mt-3 mb-2">
<div class="row">
<div class="col-2 col-lg-1 bg-primary pt-2 pb-2 text-end">
<span class="fs-4 fw-bold text-white">#</span>
</div>
<div class="col-2 bg-light pt-2 pb-2 d-none d-lg-block">
<span class="fs-4 fw-bold text-dark">Profile Image</span>
</div>
<div class="col-2 col-lg-2 bg-primary pt-2 pb-2 d-none d-lg-block">
<span class="fs-4 fw-bold text-white">Email</span>
</div>
<div class="col-6 col-lg-2 bg-light pt-2 pb-2 ">
<span class="fs-4 fw-bold ">User Name</span>
</div>
<div class="col-2 col-lg-2 bg-primary pt-2 pb-2 d-none d-lg-block">
<span class="fs-4 fw-bold text-white">Mobile</span>
</div>
<div class="col-2 col-lg-2 bg-light pt-2 pb-2 d-none d-lg-block">
<span class="fs-4 fw-bold">Registerd Date</span>
</div>
<div class="col-4 col-lg-1 bg-white pt-2 pb-2 d-grid"></div>
</div>
</div> -->
<div class="col-11 col-lg-10 mx-auto mb-3 rounded border border-primary" id="view1" style="background-color: rgba(211, 224, 243, 0.603);">
<div class="row">
<div class="col-10 offset-1 ">
<div class="row">
<?php
if (isset($_GET["page"])) {
$pageno = $_GET["page"];
} else {
$pageno = 1;
}
$usersrs = Database::search("SELECT * FROM `user` WHERE `email` != '[email protected]' ");
$d = $usersrs->num_rows;
$row = $usersrs->fetch_assoc();
$results_per_page = 10;
$number_of_pages = ceil($d / $results_per_page);
$page_first_result = ((int)$pageno - 1) * $results_per_page;
$selectedrs = Database::search("SELECT * FROM `user` WHERE `email` != '[email protected]' LIMIT " . $results_per_page . " OFFSET " . $page_first_result . " ");
$srn = $selectedrs->num_rows;
$c = "0";
while ($srow = $selectedrs->fetch_assoc()) {
$c = $c + 1;
?>
<!-- <div class="col-12 mb-2">
<div class="row">
<div class="col-2 col-lg-1 bg-primary pt-2 pb-2 text-end">
<span class="fs-5 fw-bold text-white"><?php echo $c; ?></span>
</div>
<?php
$profileimg = Database::search("SELECT * FROM `profile_img` WHERE `user_email`='" . $srow["email"] . "' ");
$img = $profileimg->num_rows;
if ($img == 1) {
$code = $profileimg->fetch_assoc();
?>
<div class="col-2 bg-light pt-2 pb-2 d-none d-lg-block">
<img src="<?php echo $code["code"]; ?>" style="height: 60px; margin-left: 100px;" />
</div>
<?php
} else {
?>
<div class="col-2 bg-light pt-2 pb-2 d-none d-lg-block">
<img src="resources/demoProfileImg.jpg" style="height: 60px; margin-left: 100px;">
</div>
<?php
}
?>
<div class="col-2 col-lg-2 bg-primary pt-2 pb-2 d-none d-lg-block">
<span class="fs-5 fw-bold text-white"><?php echo $srow["email"]; ?></span>
</div>
<div class="col-6 col-lg-2 bg-light pt-2 pb-2" onclick="viewmsgmodal('<?php echo $srow['email']; ?>');">
<span class="fs-5 fw-bold"><?php echo $srow["fname"], " " . $srow["lname"]; ?></span>
</div>
<div class="col-2 col-lg-2 bg-primary pt-2 pb-2 d-none d-lg-block">
<span class="fs-5 fw-bold text-white"><?php echo $srow["mobile"]; ?></span>
</div>
<div class="col-2 bg-light pt-2 pb-2 d-none d-lg-block">
<span class="fs-5 fw-bold">
<?php
$rd = $srow["register_date"];
$spliterd = explode(" ", $rd);
echo $spliterd[0];
?>
</span>
</div>
<div class="col-4 col-lg-1 bg-white pt-2 pb-2 d-grid">
<?php
$s = $srow["status_id"];
if ($s == "1") {
?>
<button id="blockbtn<?php echo $srow['email']; ?>" class="btn btn-danger" style="height: 40px;" onclick="blockuser('<?php echo $srow['email']; ?>');">Block</button>
<?php
} else {
?>
<button class="btn btn-success" style="height: 40px;" onclick="blockuser('<?php echo $srow['email']; ?>');">Unblock</button>
<?php
}
?>
</div>
</div>
</div> -->
<div class="card mb-3 mt-3 col-12 col-lg-5 bg-white mx-auto text-center" style="border-radius: 15px;" >
<div class="row ">
<?php
// $pimgrs = Database::search("SELECT * FROM `images` WHERE `product_id`='" . $srow["id"] . "' ");
// $pir = $pimgrs->fetch_assoc();
?>
<?php
$profileimg = Database::search("SELECT * FROM `profile_img` WHERE `user_email`='" . $srow["email"] . "' ");
$img = $profileimg->num_rows;
if ($img == 1) {
$code = $profileimg->fetch_assoc();
?>
<div class="col-md-4 mt-4" onclick="viewmsgmodal('<?php echo $srow['email']; ?>');">
<img src="<?php echo $code["code"]; ?>" style="height: 80px;" class="img-fluid rounded-start" />
</div>
<?php
} else {
?>
<div class="col-md-4 mt-4" onclick="viewmsgmodal('<?php echo $srow['email']; ?>');">
<img src="resources/demoProfileImg.jpg" style="height: 80px; " class="img-fluid rounded-start">
</div>
<?php
}
?>
<!-- <div class="col-md-4 mt-4">
<img src="<?php echo $pir["code"]; ?>" class="img-fluid rounded-start">
</div> -->
<div class="col-md-8">
<div class="card-body">
<h5 class="card-title fw-bold"><?php echo $srow["fname"] . " " . $srow["lname"]; ?></h5>
<span class="card-text fw-bold text-primary"><?php echo $srow["email"]; ?></span>
<br />
<span class="card-text fw-bold text-info">Mobile : <?php echo $srow["mobile"]; ?></span><br />
<span class="card-text fw-bold text-success">Registerd Date : <?php echo $spliterd[0]; ?></span>
<!-- <div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="check" onchange="changeStatus(<?php echo $srow['id']; ?>);" <?php
if ($srow["status_id"] == 2) {
echo "checked";
} ?> />
<label class="form-check-label fw-bold text-info" for="check" id="checklabel<?php echo $srow['id']; ?>">
<?php
if ($srow["status_id"] == 2) {
echo "Make Your Product Active";
} else {
echo "Make Your Product Deactive";
}
?>
</label>
</div> -->
<div class="col-6 mx-auto">
<div class="row">
<!-- <div class="col-12 col-lg-6">
<a href="#" class="btn btn-success d-grid" onclick="sendid(<?php echo $srow['id']; ?>);">Update</a>
</div> -->
<!-- <div class="col-12 col-lg-6 mt-1 mt-lg-0">
<a href="#" class="btn btn-danger d-grid" onclick="deleteModel(<?php echo $srow['id']; ?>);">Delete</a>
</div> -->
<?php
$s = $srow["status_id"];
if ($s == "1") {
?>
<button id="blockbtn<?php echo $srow['email']; ?>" class="btn btn-danger" style="height: 40px;" onclick="blockuser('<?php echo $srow['email']; ?>');">Block</button>
<?php
} else {
?>
<button class="btn btn-success" style="height: 40px;" onclick="blockuser('<?php echo $srow['email']; ?>');">Unblock</button>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="mesgmodal<?php echo $srow['email']; ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Chat</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" style="height: 550px;">
<div class="col-12 py-1 px-2">
<div class="row rounded shadow" style="height: 500px;">
<!-- <div class="col-12 col-lg-5 mx-lg-3 px-0">
<div class="bg-white">
<div class="bg-light px-4 py-2">
<h5 class="mb-0 py-1">Recent</h5>
</div>
<div class="message-box">
<div class="list-group rounded-0" id="rcv<?php echo $srow['email']; ?>">
</div>
</div>
</div>
</div> -->
<div class="col-11 mx-auto px-0 mt-1" style="height: 430px;">
<div class="row px-1 py-5 text-white chatbox" id="chatrow<?php echo $srow['email']; ?>">
<!-- massage load venne methana -->
</div>
</div>
<!-- text -->
<div class="col-12 mb-2">
<div class="row mb-2">
<div class="input-group">
<input id="msgtxt<?php echo $srow['email']; ?>" type="text" placeholder="Type a message..." aria-describedby="sendbtn" class="form-control" style="border-radius: 20px;" />
<div class="input-group-appeng">
<button id="button-addon2" onclick="admin_sendmessage('<?php echo $srow['email']; ?>');" class="btn btn-link fs-4 bi bi-cursor-fill"></button>
</div>
</div>
</div>
</div>
<!-- text -->
</div>
</div>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
</div> -->
</div>
</div>
</div>
<?php
}
?>
<div class="col-12 text-center fs-5 fw-bold mt-3 mb-3">
<div class="pagination">
<a href="<?php
if ($pageno <= 1) {
echo "#";
} else {
echo "?page=" . ($pageno - 1);
}
?>">«</a>
<?php
for ($page = 1; $page <= $number_of_pages; $page++) {
if ($page == $pageno) {
?>
<a href="<?php echo "?page=" . ($page); ?>" class="ms-1 active"><?php echo $page; ?></a>
<?php
} else {
?>
<a href="<?php echo "?page=" . ($page); ?>" class="ms-1"><?php echo $page; ?></a>
<?php
}
}
?>
<a href="<?php
if ($pageno >= $number_of_pages) {
echo "#";
} else {
echo "?page=" . ($pageno + 1);
}
?>">»</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- footer -->
<?php require "footer.php"; ?>
<!-- footer -->
</div>
</div>
<script src="script.js"></script>
<script src="bootstrap.bundle.js"></script>
</body>
</html>
<?php
// } else {
?>
<script>
window.location = "adminsignin.php";
</script>
<?php
// }
?>