-
Notifications
You must be signed in to change notification settings - Fork 0
/
student_dashboard.php
432 lines (385 loc) · 11.2 KB
/
student_dashboard.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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<?php
session_start();
// Check if user is logged in
if (!isset($_SESSION['userID'])) {
// If not logged in, redirect to login page
header("Location: index.php");
exit();
}
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Connect to MySQL database
$conn = new mysqli("localhost", "root", "", "test0");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Escape user inputs for security
$userID = $_SESSION['userID'];
$complaintType = $conn->real_escape_string($_POST["complaint_type"]);
$description = $conn->real_escape_string($_POST["description"]);
$building = $conn->real_escape_string($_POST["building"]);
$room = $conn->real_escape_string($_POST["room"]);
// Generate a unique ticket ID
$ticketID = uniqid();
// Query to insert complaint and get the inserted complaint ID
$sql = "INSERT INTO Complaints (UserID, ComplaintType, Description, Building, Room, Status,TicketID) VALUES ('$userID', '$complaintType', '$description', '$building', '$room', 'Open', '$ticketID')";
if ($conn->query($sql) === TRUE) {
// Close connection
$conn->close();
// Complaint submitted successfully, redirect to new page with ticket ID
header("Location: complaint_confirmation.php?ticket_id=" . $ticketID);
exit();
} else {
// Error occurred, redirect to homepage with error message
header("Location: index.php?error=2");
exit();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Submit Complaint</title>
<link rel="icon" href="assets/icon.gif" type="image/x-icon">
<link rel="shortcut icon" href="assets/icon.gif" type="image/x-icon">
<style>
h1 {
font-size: 4vmax;
text-align: center;
color: #fff;
}
h2 {
font-size: 3vmax;
text-align: center;
color: #333333;
}
.nav{
background: -webkit-linear-gradient(
right,
#56d8e4,
#9f01ea,
#56d8e4,
#9f01ea
);
}
@import url("https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap");
* {
margin: 0;
padding: 0;
outline: none;
box-sizing: border-box;
font-family: 'Candara';
}
body {
background-color: #b7d0f7;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
font-family: 'Candara';
color: #333333;
}
.container {
margin: 0 auto; /* Center the container horizontally */
max-width: 800px;
background: #fff;
padding: 25px 40px 10px 40px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
margin-top: 50px; /* Adjust the top margin as needed */
}
.container .text {
text-align: center;
font-size: 41px;
font-weight: 600;
font-family: "Poppins", sans-serif;
background: -webkit-linear-gradient(
right,
#56d8e4,
#9f01ea,
#56d8e4,
#9f01ea
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.container form {
padding: 30px 0 0 0;
}
.container form .form-row {
display: flex;
margin: 32px 0;
}
form .form-row .input-data {
width: 100%;
height: 40px;
margin: 0 20px;
position: relative;
}
form .form-row .textarea {
height: 70px;
}
.input-data input,
.textarea textarea {
display: block;
width: 100%;
height: 100%;
border: none;
font-size: 17px;
border-bottom: 2px solid rgba(0, 0, 0, 0.12);
}
.input-data input:focus ~ label,
.textarea textarea:focus ~ label,
.input-data input:valid ~ label,
.textarea textarea:valid ~ label {
transform: translateY(-20px);
font-size: 14px;
color: #3498db;
}
.textarea textarea {
resize: none;
padding-top: 10px;
}
.input-data label {
position: absolute;
pointer-events: none;
bottom: 10px;
font-size: 16px;
transition: all 0.3s ease;
}
.textarea label {
width: 100%;
bottom: 40px;
background: #fff;
}
.input-data .underline {
position: absolute;
bottom: 0;
height: 2px;
width: 100%;
}
.input-data .underline:before {
position: absolute;
content: "";
height: 2px;
width: 100%;
background: #3498db;
transform: scaleX(0);
transform-origin: center;
transition: transform 0.3s ease;
}
.input-data input:focus ~ .underline:before,
.input-data input:valid ~ .underline:before,
.textarea textarea:focus ~ .underline:before,
.textarea textarea:valid ~ .underline:before,
.input-data select:focus ~ .underline:before {
transform: scale(1);
}
select {
display: block;
width: 100%;
height: 100%;
border: none;
font-size: 17px;
border-bottom: 2px solid rgba(0, 0, 0, 0.12);
margin-bottom: 10px;
}
.slab {
margin-bottom: 40px;
}
.submit-btn .input-data {
overflow: hidden;
height: 45px !important;
width: 25% !important;
}
.submit-btn .input-data .inner {
height: 100%;
width: 300%;
position: absolute;
left: -100%;
background: -webkit-linear-gradient(
right,
#56d8e4,
#9f01ea,
#56d8e4,
#9f01ea
);
transition: all 0.4s;
}
.submit-btn .input-data:hover .inner {
left: 0;
}
.submit-btn .input-data input {
background: none;
border: none;
color: #fff;
font-size: 17px;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 1px;
cursor: pointer;
position: relative;
z-index: 2;
}
@media (max-width: 700px) {
.container .text {
font-size: 30px;
}
.container form {
padding: 10px 0 0 0;
}
.container form .form-row {
display: block;
}
form .form-row .input-data {
margin: 35px 0 !important;
}
.submit-btn .input-data {
width: 40% !important;
}
}
/* Menu btn */
.menu-btn {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
z-index: 1000;
}
/* SVG styling */
.menu-btn svg {
width: 30px;
height: 30px;
fill: #333; /* Initial color */
transition: fill 0.3s ease, transform 0.3s ease;
}
.menu-btn.clicked svg {
fill: #007bff; /* Color on click */
transform: rotate(90deg); /* Rotate the button on click */
}
.menu-btn.animate {
animation: bounce 0.3s ease; /* Add a bounce animation */
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-10px);
}
60% {
transform: translateY(-5px);
}
}
.menu-options {
position: fixed;
top: 80px;
right: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 0 4px;
display: none;
z-index: 999;
height: 135px;
width: 13%;
opacity: 0.7;
}
.menu-options a {
font-size: 18px;
display: block;
text-decoration: none;
color: #333;
padding: 10px 0;
}
.menu-options.show {
display: block;
}
</style>
</head>
<body>
<div class="nav">
<h1>
Welcome,
<?php
$user=strtoupper($_SESSION['username']);
echo $user; ?>!
</h1>
</div>
<div class="container">
<h2>Submit a Complaint</h2>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div class="form-row">
<div class="input-data textarea">
<select name="complaint_type">
<option value="Cleaning">Cleaning</option>
<option value="Electrical Work">Electrical Work</option>
<option value="Plumbing">Plumbing</option>
<option value="IT Support">IT Support</option>
<!-- Add more options as needed --></select
><br />
<div class="underline"></div>
<label for="complaint_type" class="slab">Complaint Type</label>
<br />
</div>
</div>
<div class="form-row">
<div class="input-data textarea">
<textarea name="description" rows="4" cols="50" required></textarea>
<br />
<div class="underline"></div>
<label for="description">Description</label>
<br />
</div>
</div>
<div class="form-row">
<div class="input-data">
<input type="text" name="building" required />
<div class="underline"></div>
<label for="building">Building</label>
</div>
<div class="input-data">
<input type="text" name="room" required />
<div class="underline"></div>
<label for="room">Room</label>
</div>
</div>
<div class="form-row submit-btn">
<div class="input-data">
<div class="inner"></div>
<input type="submit" value="Submit" />
</div>
</div>
</form>
</div>
<br />
<!-- Menu Button -->
<div class="menu-btn" onclick="toggleMenu()">
<!-- SVG for the menu button -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</div>
<!-- Menu Options -->
<div class="menu-options">
<a href="#">Home</a>
<a href="status.php">Check Ticket Status</a>
<a href="logout.php">Logout</a>
</div>
<script>
function toggleMenu() {
var menuOptions = document.querySelector('.menu-options');
menuOptions.classList.toggle('show');
// Change color and add animation on click
var menuBtn = document.querySelector('.menu-btn');
menuBtn.classList.toggle('clicked');
menuBtn.classList.toggle('animate');
// Reset animation after a short delay
setTimeout(() => {
menuBtn.classList.remove('animate');
}, 300);
}
</script>
</body>
</html>