138 lines
2.9 KiB
PHP
Executable File
138 lines
2.9 KiB
PHP
Executable File
<?php include('config.php'); ?>
|
|
<?php
|
|
session_start();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<style>
|
|
/* * {box-sizing: border-box;}
|
|
|
|
body {
|
|
margin: 0;
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
}
|
|
|
|
.header {
|
|
overflow: hidden;
|
|
background-color: #f1f1f1;
|
|
padding: 20px 10px;
|
|
}
|
|
|
|
.header a {
|
|
float: left;
|
|
color: black;
|
|
text-align: center;
|
|
padding: 12px;
|
|
text-decoration: none;
|
|
font-size: 18px;
|
|
line-height: 25px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.header a.logo {
|
|
font-size: 25px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.header a:hover {
|
|
background-color: #ddd;
|
|
color: black;
|
|
}
|
|
|
|
.header a.active {
|
|
background-color: dodgerblue;
|
|
color: white;
|
|
}
|
|
|
|
.header-right {
|
|
float: right;
|
|
}
|
|
|
|
@media screen and (max-width: 500px) {
|
|
.header a {
|
|
float: none;
|
|
display: block;
|
|
text-align: left;
|
|
}
|
|
|
|
.header-right {
|
|
float: none;
|
|
}
|
|
}
|
|
*/
|
|
table {
|
|
font-family: arial, sans-serif;
|
|
border-collapse: collapse;
|
|
width: 70%;
|
|
}
|
|
|
|
td, th {
|
|
border: 1px solid #dddddd;
|
|
text-align: left;
|
|
padding: 8px;
|
|
}
|
|
|
|
tr:nth-child(even) {
|
|
background-color: #dddddd;
|
|
}
|
|
|
|
.hnlink {
|
|
text-decoration:none;
|
|
color: #09BC8A;
|
|
}
|
|
.commentslink {
|
|
text-decoration:none;
|
|
color: #13ECB0;
|
|
font-size: 60%
|
|
}
|
|
.hntable {
|
|
padding-top: 50px;
|
|
padding-right: 30px;
|
|
padding-bottom: 50px;
|
|
padding-left: 80px;
|
|
}
|
|
</style>
|
|
<meta charset="utf-8">
|
|
<title><?= $siteName; ?></title>
|
|
<link href="account/style.css" rel="stylesheet" type="text/css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer">
|
|
</head>
|
|
<body class="loggedin">
|
|
<nav class="navtop">
|
|
<div>
|
|
<h1><?= $siteName; ?></h1>
|
|
<a href="account/index.php"><i class="fas fa-gear"></i>Account</a>
|
|
<a href="submit.php"><i class="fas fa-pencil"></i>Post</a>
|
|
<a href="users.php"><i class="fas fa-users"></i>Users</a>
|
|
<a href="account/logout.php"><i class="fas fa-sign-out-alt"></i>Logout</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<br>
|
|
<?php
|
|
|
|
// Create connection
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
// Check connection
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
$quersy = $conn->query("SELECT * FROM posts ORDER BY id DESC");
|
|
|
|
// $conn->query($query)
|
|
|
|
$conn->query("SELECT * FROM users");
|
|
|
|
print "<div class='hntables'><center><table>";
|
|
while($rows = mysqli_fetch_assoc($quersy)) {
|
|
print "<tr><td><a class='hnlink' href='".htmlspecialchars($rows['url'])."'>".htmlspecialchars($rows['title'])."</a> <a class='commentslink' href='comments.php?postid=".htmlspecialchars($rows['id'])."'>comments</a></td><td>Posted by: ".htmlspecialchars($rows['poster'])."</td></tr>";
|
|
}
|
|
print "</table></center></div>";
|
|
|
|
?>
|
|
|
|
</body>
|
|
</html>
|