-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubjects.php
More file actions
64 lines (56 loc) · 1.78 KB
/
subjects.php
File metadata and controls
64 lines (56 loc) · 1.78 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
<?php
require_once('load.php');
// Handle logins
if($_SERVER["REQUEST_METHOD"] == "POST") {
$login_status = $login->verify_login($_POST);
}
// Verify session
if ( $login->verify_session() ) {
$user = $login->user;
$userType = $user->userType;
include('header.php'); ?>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: center;
}
tr:hover td {
background-color: #b7e5eb;
}
table tr[data-href] {
cursor: pointer;
}
tr:nth-child(even) {background-color: #e0dede;}
</style>
<div class="wrapper">
<?php
$subjects = $db->query("SELECT * FROM subjects");
echo "<table><tbody><tr><th>Εξάμηνο</th><th>Μάθημα</th></tr>\r\n";
foreach ($subjects as $result) {
echo "<tr data-href='upload_form.php?id=$result->id&subject=$result->name'>\r\n";
echo "<td>" . $result->semester . "</td>\r\n";
echo "<td>" . $result->name . "</td>\r\n";
echo "</tr>\r\n";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('table tr').click(function(){
window.location = $(this).data('href');
return false;
});
});
</script>
<?php
}
echo "</tbody></table>\r\n";
?>
</div>
<?php include('footer.php');
} else {
include( 'login.php' );
}