-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubject.php
More file actions
115 lines (109 loc) · 3.69 KB
/
Copy pathsubject.php
File metadata and controls
115 lines (109 loc) · 3.69 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
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
<?php
session_start();
include 'dbcon.php';
error_reporting(0);
// if(!(isset($_SESSION["login"]) && $_SESSION["login"] == "OK")) {
// header("Location: login.html");
// exit;
// }
$username = $_SESSION['username'];
$subject = $_GET['subject'];
$year = $_GET['year'];
$_SESSION['subject_sess'] = $subject;
$_SESSION['year_sess'] = $year;
//$sql = "SELECT * FROM Projects WHERE projectid IN (SELECT $subject FROM $year)";
$sql = "SELECT * FROM (
SELECT * FROM Projects WHERE Subject='$subject' ORDER BY upload_time DESC
) sub
ORDER BY upload_time DESC";
// $sql = "SELECT * FROM Projects WHERE Subject='$subject'";
// $sql = "SELECT TOP 10 projectid FROM Projects ORDER BY upload_time DESC";
// $sql = "SELECT projectid FROM (SELECT TOP 10 projectid FROM Projects ORDER BY upload_time DESC) SQ ORDER BY upload_time ASC";
$result = mysqli_query($conn, $sql);
if (!$result) {
printf("Error: %s\n", mysqli_error($conn));
exit();
}
$count = mysqli_num_rows($result);
$_SESSION['row_count'] = $count;
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title><?php echo $subject ?></title>
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="dashboard.css">
<link rel="stylesheet" href="subject.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap" rel="stylesheet">
</head>
<body>
<div class="header">
<div class="inner_header">
<div class="logo_container">
<a href="dashboard.php">
<img src="images/Logo.svg" alt="ProjectStack">
</a>
</div>
<ul class="navigation">
<a href="dashboard.php"><li>Projects</li></a>
<?php if((isset($_SESSION["login"]) && $_SESSION["login"] == "OK")) {
echo "<a href='profile.php'><li>". $username. "</li></a>";
echo "<a href='logout.php'><li>Logout</li></a>";
}
?>
</ul>
</div>
</div>
<div class="home">
<div class="recent_proj">
<div class="browse">
<h2>Browse the recent projects</h2>
</div>
<div class="recent">
<?php
echo "<table>";
echo "<th>";
echo "<tr>";
echo "<th>Topic</th>";
echo "<th>Contributor</th>";
echo "<th>Date</th>";
echo "</tr>";
echo "</th>";
while($row = mysqli_fetch_array($result)){
$time = $row['upload_time'];
$temptime = strtotime($time);
$finaltime = date("d/m/y g:i A", $temptime);
echo "<tr>";
echo "<td><a class='varlink' href='project.php?projectid=" .$row['projectid'] . "'>" .$row['topic']. "</a></td>";
echo "<td><a href='profile.php?username=" .$row['UserName']. "'>".$row['UserName']. "</td>";
echo "<td>" .$finaltime. "</td>";
echo "</tr>";
}
echo "</table>";
echo "<a href='upload.html?subject=" .$subject. "&year=" .$year. "'><div class='upload_btn'>Upload</div></a>";
?>
</div>
</div>
<footer class="footer">
<div class="footer_logo">
<img src="images/Logo.svg">
</div>
<div>
<h3>Read more about<br>our mission</h3>
<a href="about.html"><h4>About Us</h4></a>
</div>
<div>
<h3>Legal</h3>
<h4>T&C</h4>
<h4>Policies</h4>
</div>
<div class="social_links">
<h3>Social</h3>
<h4>Twitter</h4>
<h4>Instagram</h4>
<h4>Facebook</h4>
</div>
</footer>
</body>
</html>