From 8bfcf9fbb385ca03177254ad462d0c36988e849d Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 1 Aug 2021 11:40:23 +0000 Subject: [PATCH] Allow graceful fail if message does not exist when access by message-id. Improve this in the future --- Rocksolid_Light/rocksolid/article-flat.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Rocksolid_Light/rocksolid/article-flat.php b/Rocksolid_Light/rocksolid/article-flat.php index 0304f0c..2eb0358 100644 --- a/Rocksolid_Light/rocksolid/article-flat.php +++ b/Rocksolid_Light/rocksolid/article-flat.php @@ -30,16 +30,18 @@ $articles_dbh = article_db_open($database); $articles_query = $articles_dbh->prepare('SELECT * FROM articles WHERE msgid=:messageid'); $articles_query->execute(['messageid' => $id]); + $found = 0; while ($row = $articles_query->fetch()) { $id = $row['number']; + $found = 1; break; } $dbh = null; - $newurl = 'article-flat.php?id='.$id.'&group='.$group.'#'.$id; -// $newurl.='#'.$id; - - header("Location: $newurl"); - die(); + if($found) { + $newurl = 'article-flat.php?id='.$id.'&group='.$group.'#'.$id; + header("Location: $newurl"); + die(); + } } }