Allow graceful fail if message does not exist when access by message-id. Improve this in the future

This commit is contained in:
Retro_Guy 2021-08-01 11:40:23 +00:00
parent 81c083596d
commit 8bfcf9fbb3
1 changed files with 7 additions and 5 deletions

View File

@ -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();
}
}
}