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!'); $pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$error = false; $error = false;
$error_message = ""; $error_message = "";
echo "<p>Public boards:</p>"
if (!$error) { if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards ORDER BY id asc"); $statement = $pdo->prepare("SELECT * FROM boards ORDER BY id asc");
$statement->execute(); $statement->execute();
@ -35,6 +36,16 @@ $navbar="boards";
if (!$result) { if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2]; $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> </ul>
</div> </div>