-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_to_admin.php
69 lines (58 loc) · 2.04 KB
/
list_to_admin.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
<?php
// session_start();
require_once("cont/connection.php");
require_once("cont/header_admin.php");
// ------------------------------------------------------------------------
$user_email = $_SESSION["u_email"];
$user_password = $_SESSION["u_password"];
$sql = "SELECT email, password FROM admins WHERE email='$user_email' AND password='$user_password' ";
$result = $conn->query($sql);
if ($result -> num_rows > 0) {
$sql_2 = "SELECT * FROM car_owners";
$result_2 = $conn->query($sql_2);
echo "<div class=\"form\" id=\"list-admin\">";
if ($result_2 -> num_rows > 0) {
// output data of each row
echo "<table border = 1>
<tr>
<th>Id</th>
<th>First name</th>
<th>Last Name</th>
<th>NIC Number</th>
<th>City</th>
<th>Email</th>
</tr>";
while ($row = $result_2 -> fetch_assoc()) {
echo "<tr>";
echo "<td>". $row['member_id'] ."</td>";
echo "<td>". $row['f_name'] ."</td>";
echo "<td>". $row['l_name'] ."</td>";
echo "<td>". $row['nic'] ."</td>";
echo "<td>". $row['city'] ."</td>";
echo "<td>". $row['email'] ."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<div class=\"form\"><div class=\"title\">Error getting member list.</div>";
echo "
<div class=\"subtitle\">Database may be empty.</div>
<form action=\"login_test.php\" method=\"GET\">
<input class=\"submit ic1\" type=\"submit\" value=\"Login\">
</form>";
echo "</div>";
// echo "Error getting member's list";
}
echo "</div>";
} else {
echo "<div class=\"form\"><div class=\"title\">Admin authentication error.</div>";
echo "
<form action=\"login_test.php\" method=\"GET\">
<input class=\"submit ic1\" type=\"submit\" value=\"Login\">
</form>";
echo "</div>";
// echo "Admin authentication error";
}
require_once("cont/footer.php");
$conn->close();
?>