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

66 lines
2.3 KiB
PHP

<?php
session_start();
%SET_LOGIN_VARIABLE%
%PLEAZE_NO_CACHE%
%NO_CHEAP_SESSION_STEALING%
$navbar="boards";
?>
<!DOCTYPE html>
<html>
<head>
<title>ThreadR - Boards</title>
%STYLESHEET%
<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>
%NAVBAR%
<div class="container">
<div class="item-1">
<h1><center>ThreadR Boards</center></h1>
</div>
<div class="item-2">
<ul class="list">
<?php
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$error = false;
$error_message = "";
if (!$error) {
echo '<center><h2 class="beige">Public Boards</h2></center>';
$statement = $pdo->prepare("SELECT * FROM boards WHERE private='0' ORDER BY id asc");
$statement->execute();
foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/board/?id=$ROW[id]'>$ROW[name]</a></li>";
}
}
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
}
?>
</ul>
</div>
<div class="item-3">
<ul class="list">
<?php
if ($login) {
$error = false;
$error_message = "";
if (!$error) {
echo '<center><h2 class="beige">Private Boards</h2></center>';
$statement = $pdo->prepare("SELECT * FROM boards WHERE private='1' ORDER BY id asc");
$statement->execute();
foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/board/?id=$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>