-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus.php
122 lines (93 loc) · 2.99 KB
/
status.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
<?php
header("X-XSS-Protection: 1; mode=block");
session_start();
?>
<html>
<head>
<title>Hostel Query Management System</title>
<link rel = "icon" href="pictures/favicon.png"
type = "image/x-icon">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
<script src="buttons.js"></script>
<style>
.white{
color: white;
text-align: center;
margin-top: 10px;
}
.butt{
text-align: center;
margin-top: 10px;
}
body {
background-image: url(pictures/pexels-pixabay-357514.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
.width{
max-width: 650px;
text-align: center;
margin: auto;
margin-top: 20px;
}
.centre{
margin-top: 270px;
}
.pad{
padding-top: 20px;
}
</style>
</head>
<body>
<?php
error_reporting(0);
if($_SESSION["username"]) {
?>
<strong style="color:white;">
Welcome <?php echo htmlspecialchars($_SESSION["username"]); ?>. <button id="logout" onclick="myFunction()" class="btn btn-secondary" type="button">Logout</button>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "hostel_query_management_system";
$error="There is nothing to show.<hr>";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT username, date, query FROM queries ORDER BY date";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$field1name = $row["username"];
$field2name = $row["date"];
$field3name = $row["query"];
$print = "<br>Username : ". $field1name. " || Dated : ". $field2name. " || Problem Description : " . $field3name ."</br><hr>";
echo '<div class="alert alert-success pad width" role="alert">
'.$print.'
</div>';
}
} else {
echo '<div class="alert alert-danger pad width" role="alert">
'.$error.'
</div>';
}
$conn->close();
?>
<div class="container white">
<button id="delete" onclick="mynewestFunction3()" class="btn btn-secondary butt"><strong>Delete Queries</strong></button>
<button id="update" onclick="mynewestFunction4()" class="btn btn-secondary butt"><strong>Update Queries</strong></button>
</div>
<?php
}else header("Location:index.php");
?>
</strong>
</body>
</html>