-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadmin-users.php
More file actions
85 lines (67 loc) · 2.25 KB
/
Copy pathadmin-users.php
File metadata and controls
85 lines (67 loc) · 2.25 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
<?php include('includes/connection.php') ?>
<?php include('includes/session.php') ?>
<?php
error_reporting(E_ALL & ~E_NOTICE);
//Unauthorized Access Check
checkSession();
if(!isset($_SESSION['usertype']) || $_SESSION['usertype'] != 'a'){
$message = base64_encode(urlencode("Please Login"));
header('Location:login.php?msg=' . $message);
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Admin | Ceylon Beverages</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php include('includes/header.php') ?>
<hr>
<div class="row-50">
<h1 class="div-c">View Users</h1>
</div>
<div class="row-50 bg-grey">
<div class="row-100 navigation">
<ul class="left-nav bg-green">
<li><a href="admin-users.php" class="bg-green" >View Users</a></li>
<li><a href="admin-user-add.php" class="bg-green" >Add Users</a></li>
<li><a href="admin-user-edit.php" class="bg-green" >Edit Users</a></li>
<li><a href="admin-user-delete.php" class="bg-green" >Delete Users</a></li>
</ul>
</div>
</div>
<?php
echo "<table border=1 class=\"user\">
<tr>
<th>User id</th>
<th>User type</th>
<th>User name</th>
<th>Email</th>
<th>Contact No</th>
</tr>";
$allus = "SELECT * FROM users";
$userquery = mysqli_query($connection,$allus);
while($row = mysqli_fetch_assoc($userquery)){
if($row['usertype']=='a'){
$type= "Admin";
}
elseif($row['usertype']=='v'){
$type="Vendor";
}
else{
$type="Customer";
}
echo "<tr>
<td>".$row['userID']."</td>
<td>".$type."</td>
<td>".$row['name']."</td>
<td>".$row['email']."</td>
<td>".$row['contact']."</td>
</tr>";
}
echo "</table>";
?>
</body>
</html>