forked from alkatrivedi/Anavadya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.php
159 lines (133 loc) · 5.68 KB
/
users.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
<?php
session_start();
require_once "config.php";
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
header("location: login.php");
}
if($_SESSION["room"]>0)
{
header("location: occupancy.php");
}
if (isset($_GET['delete'])) {
$id = $_GET['delete'];
$conn->query("DELETE FROM users WHERE id=$id") or die('error querring database.');
}
// or die($conn->error())
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="keywords" content="footer, address, phone, icons" />
<link rel="icon" href="public/assets/24-hours.png" sizes="40x40" type="image/svg">
<title>Anavadya</title>
<link rel="stylesheet" type="text/css" href="public/css/main.css">
<!-- Link to Bootstrap-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<!-- Link to font awesome-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script>
$(function() {
// $("#navid").load("partials/header.php");
$("#footid").load("partials/footer.php");
});
</script>
</head>
<body>
<!-- <div id="navid"></div> -->
<nav id="mainNavbar" class=" stroke navbar navbar-expand-md fixed-top navbar-dark">
<a class="navbar-brand">
<img class="navlogo" src="public/assets/24-hours.png"> Anavadya
</a>
<button class="navbar-toggler nav-toggle-btn" type="button" data-toggle="collapse" data-target="#navLinks" aria-label="Toggle navigation">
<span class="navbar-toggler-icon">
</span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navLinks">
<ul class="navbar-nav">
<li class="nav-item active">
<a href="home.php" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="buildingDetails.php" class="nav-link">Building Details</a>
</li>
<li class="nav-item">
<a href="occupancy.php" class="nav-link">Occupancy</a>
</li>
<li class="nav-item">
<a href="contacts.php" class="nav-link">Contact Us</a>
</li>
<li class="nav-item">
<a href="register.php" class="nav-link" id="signin">Register</a>
</li>
<?php
if (isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == true) {
?>
<li class="nav-item">
<a href="logout.php" class="nav-link">Logout</a>
</li>
<?php
} else {
?>
<li class="nav-item">
<a href="login.php" class="nav-link">Login</a>
</li>
<?php
}
?>
</ul>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#"><img src="https://img.icons8.com/metro/26/ffffff/user-male.png" /><?php echo "Welcome " . $_SESSION['username'] ?></a>
</li>
</ul>
</div>
</nav>
<style rel="stylesheet" type="text/css">
body {
background-image: linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%);
}
</style>
<link rel="stylesheet" type="text/css" href="public/css/user.css">
</link>
<h2 style="margin-top:8rem;text-align:center;">All the Sub-Admins using this App for Prozone</h2>
<div class="main">
<ul class="cards">
<?php
require_once "config.php";
function component($id, $username, $userimg, $roomno)
{
$element = '
<li class="cards_item">
<div class="card">
<div class="card_image"><img src="' . $userimg . '"></div>
<div class="card_content">
<h2 class="card_title">
Name
</h2>
<p class="card_text"> Username:
' . $username . ' <br> Room no: ' . $roomno . ' <br>
<a href="users.php?delete=' . $id . '" class="btn card_btn">DELETE</a>
</div>
</div>
</li>
';
echo $element;
}
//
$query = "SELECT * FROM users where roomno > 0";
mysqli_query($conn, $query) or die('error querring database.');
$result = mysqli_query($conn, $query);
while ($row = mysqli_fetch_array($result)) {
component($row['id'], $row['username'], $row['userimg'], $row['roomno']);
}
?>
</ul>
</div>
<div id="footid"></div>
</body>
</html>