-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
136 lines (104 loc) · 6.24 KB
/
search.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
<?php
include('./view-c.php');
session_start();
include('./link.php');
require_once "config/conn.php";
$name = $_SESSION['name'];
$surname = $_SESSION['surname'];
$user_id = $_SESSION['id'];
$role = $_SESSION['role'];
$keyword = $_GET['k'];
if ($name == null) {
$_SESSION['login'] = false;
$html_login = "d-block";
$html_name = "d-none";
// echo $html_login;
// echo $html_name;
echo "<script>location.href = './login.php'</script>";
} else {
$_SESSION['login'] = true;
$html_login = "d-none";
$html_name = "d-block";
$surname = $_SESSION['surname'];
}
if ($role == "admin") {
echo '<script>window.location.href = "./admin"</script>';
}
require_once "config/conn-mysqli.php";
$sql = "SELECT * FROM homework WHERE subject LIKE '%".$keyword."%' OR teacher LIKE '%".$keyword."%' OR title LIKE '%".$keyword."%' OR point LIKE '%".$keyword."%' OR time LIKE '%".$keyword."%' ORDER BY id DESC";
$result = $connect->query($sql);
?>
<!doctype html>
<html lang="en">
<head>
<title>YRC13 - Homework</title>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<!-- Bootstrap CSS v5.2.1 -->
<link rel="stylesheet" href="./Framework/bootstrap/css/bootstrap.min.css">
<link rel="shortcut icon" href="./img/yrc_logo.png" type="image/png">
<link rel=”icon” type=”image/png href=”./img/yrc_logo.png” />
<link rel="stylesheet" href="./style.css">
</head>
<body>
<?php include_once('./header.php'); ?>
<main>
<div class="mt-5 mb-3">
<?php include('./banner.php'); ?>
<div class="container mt-3">
<div class="container">
<div class="card mt-3">
<div class="card-header">
<h3 class="card-title">การบ้าน</h3>
</div>
<div class="card-body w-100">
<div id="example2_wrapper" class="dataTables_wrapper dt-bootstrap4">
<div class="w-100">
<div class="table-responsive">
<table id="example2" class="table table-bordered table-hover dataTable dtr-inline" aria-describedby="example2_info">
<thead>
<tr>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">วิชา</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">ครู </th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">หัวเรื่อง</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">คะแนน</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">วันที่</th>
</tr>
</thead>
<tbody>
<?php while ($row = $result->fetch_assoc()) : ?>
<tr class="odd">
<td><?php echo $row['subject']; ?></td>
<td><?php echo $row['teacher'] ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['point']; ?></td>
<td><?php echo $row['time']; ?></td>
</tr>
<?php endwhile ?>
</tbody>
<tfoot>
<tr>
<th rowspan="1" colspan="1">วิชา</th>
<th rowspan="1" colspan="1">ครู</th>
<th rowspan="1" colspan="1">หัวเรื่อง</th>
<th rowspan="1" colspan="1" class="text-center">option</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<?php include('./footer.php'); ?>
<!-- Bootstrap JavaScript Libraries -->
<script src="./Framework/bootstrap/js/bootstrap.bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://kit.fontawesome.com/42b75145a7.js" crossorigin="anonymous"></script>
</body>
</html>