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

69 lines
2.1 KiB
PHP
Raw Normal View History

2020-02-24 04:43:53 +01:00
<?php
session_start();
%SET_LOGIN_VARIABLE%
%PLEAZE_NO_CACHE%
2020-02-24 04:43:53 +01:00
%NO_CHEAP_SESSION_STEALING%
$navbar="boards";
2020-02-24 04:43:53 +01:00
?>
2020-02-19 22:16:27 +01:00
<!DOCTYPE html>
<html>
<head>
<title>ThreadR - Boards</title>
%STYLESHEET%
%FAVICON%
<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=%DB_SERVER%;dbname=%DB_NAME%', '%DB_USERNAME%', '%DB_PASSWORD%');
$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) {
2020-03-02 08:40:56 +01:00
$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");
2020-02-19 22:20:25 +01:00
$statement->execute();
foreach($statement->fetchAll() as $ROW) {
2020-03-07 19:29:33 +01:00
echo "<li><a href='%CONTENT_DIR%/board/?id=$ROW[id]'>$ROW[name]</a></li>";
2020-02-19 22:20:25 +01:00
}
2020-03-02 08:40:56 +01:00
}
if (!$result) {
2020-02-19 22:20:25 +01:00
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
2020-03-02 08:40:56 +01:00
}
}
?>
</ul>
2020-02-19 22:43:26 +01:00
</div>
</div>
%BANNER_COOKIES%
</body>
2020-02-19 22:16:27 +01:00
</html>