-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
49 lines (47 loc) · 2.03 KB
/
index.php
File metadata and controls
49 lines (47 loc) · 2.03 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
<?php
//connection to DB
include 'resources/db_connect.php';
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>#CYB3R_CrUD</title>
<link rel="stylesheet" href="css/stylesheet.css">
</head>
<body>
<?php
if (isset($_SESSION['uID'])) {
echo $_SESSION['uName']."@CYB3R_CrUD:~$ ";
if($_SESSION['uID'] == 1){
echo '<a href="admin_panel.php">/root</a>'." ";
}
echo '<a href="favourites.php">/favourites</a>'." ".
'<a href="logout.php">/logout</a>';
}else{
echo '<a href="login.php">/login</a>'." ".
'<a href="register.php">/register</a>';
}
?>
<h1>#CYB3R_CrUD</h1>
<p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br></p>
<?php
$sql = "SELECT postID, postTitle, postDesc, postCont, postDate FROM blog_posts ORDER BY postID desc";
$result = $connection->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<a href="blog_post?pID='.$row["postID"].'">'.$row["postTitle"].'</br></a>';
echo "<br>Description: " .$row["postDesc"]. "<br>Date: " .$row["postDate"]. "<br><br>";
echo "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br><br>";
}
}else {
echo "No posts!";
}
?>
<div id="footer"><br>
<a href="https://github.com/veruz">/github</a>
<a href="about.php">/sysinfo</a>
</div>
</div>
</body>
</html>