threadr.lostcave.ddnss.de/threadr/boards/index.php

62 lines
1.9 KiB
PHP

<?php
//todo: fix automatic log out when opening "Boards"
session_start();
%NO_CHEAP_SESSION_STEALING%
?>
<!DOCTYPE html>
<html>
<head>
<title>ThreadR - Boards</title>
<link rel="stylesheet" type="text/css" href="%CONTENT_DIR%/style.css">
<link rel="icon" type="image/png" href="%CONTENT_DIR%/img/favicon-32x32.png" sizes="32x32" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<ul class="topnav">
<li>%HOME_LINK%</li>
<li><a href="%CONTENT_DIR%/news/">News</a></li>
<!--<li><a href="%CONTENT_DIR%/boards/">Boards</a></li>-->
<div class="dropdown">
<button class="dropbtn">Boards
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href="%CONTENT_DIR%/boards/">Board 1</a>
<a href="#">Board 2</a>
<a href="#">Board 3</a>
</div>
</div>
<li><a href="%CONTENT_DIR%/about/">About</a></li>
<li class="right">%LOGIN_LINK%</li>
</ul>
<br />
<div class="container">
<div class="item-1">
<h1><center>ThreadR Boards</center></h1>
</div>
<div class="item-2">
<ul class="topnav">
<?php
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$error = false;
$error_message = "";
if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards");
$statement->execute();
foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/boards?=$ROW[id]'>$ROW[name]</a></li>";
}
}
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
}
?>
</ul>
</div>
</div>
</body>
</html>