trying to list private boards when logged in

master
Jakob 2020-03-06 09:55:25 +01:00
parent 27e96d23e0
commit 965daf8284
1 changed files with 6 additions and 4 deletions

View File

@ -20,12 +20,12 @@ $navbar="boards";
</div> </div>
<div class="item-2"> <div class="item-2">
<ul class="list"> <ul class="list">
<?php /* <?php
$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 = "";
if (!$error) { if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards WHERE public = '1' ORDER BY id asc"); $statement = $pdo->prepare("SELECT * FROM boards WHERE private='0' ORDER BY id asc");
$statement->execute(); $statement->execute();
foreach($statement->fetchAll() as $ROW) { foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/boards/thread.php?id=$ROW[id]'>$ROW[name]</a></li>"; echo "<li><a href='%CONTENT_DIR%/boards/thread.php?id=$ROW[id]'>$ROW[name]</a></li>";
@ -34,9 +34,12 @@ $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) { if ($login) {
$error = false;
$error_message = "";
if (!$error) { if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards WHERE public='0' ORDER BY id asc"); $statement = $pdo->prepare("SELECT * FROM boards WHERE private='1' ORDER BY id asc");
$statement->execute(); $statement->execute();
foreach($statement->fetchAll() as $ROW) { foreach($statement->fetchAll() as $ROW) {
echo "<li><a href='%CONTENT_DIR%/boards/thread.php?id=$ROW[id]'>$ROW[name]</a></li>"; echo "<li><a href='%CONTENT_DIR%/boards/thread.php?id=$ROW[id]'>$ROW[name]</a></li>";
@ -46,7 +49,6 @@ $navbar="boards";
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2]; $error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
} }
} }
*/
?> ?>
</ul> </ul>
</div> </div>