added private boards if logged in

master
Jakob 2020-03-04 10:59:51 +01:00
parent 423cfd171d
commit 0a6efeb54b
1 changed files with 11 additions and 0 deletions

View File

@ -25,6 +25,7 @@ $navbar="boards";
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$error = false;
$error_message = "";
echo "<p>Public boards:</p>"
if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards ORDER BY id asc");
$statement->execute();
@ -35,6 +36,16 @@ $navbar="boards";
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
}
if ($login) {
echo "<p>Private boards:</p>"
if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards WHERE public='0' ORDER BY id asc");
$statement->execute();
foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/boards/thread.php?id=$ROW[id]'>$ROW[name]</a></li>";
}
}
}
?>
</ul>
</div>