Forum: better error messages (Suggested by @anyeor)

This commit is contained in:
slawkens
2023-07-07 14:34:26 +02:00
parent c392fa7272
commit 8cf0e80019
9 changed files with 82 additions and 42 deletions

View File

@@ -17,14 +17,16 @@ $errors = [];
if(!empty($action))
{
if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) {
error('Error: Action contains illegal characters.');
$errors[] = 'Error: Action contains illegal characters.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
else if(file_exists(PAGES . 'forum/' . $action . '.php')) {
require PAGES . 'forum/' . $action . '.php';
return;
}
else {
error('This page does not exists.');
$errors[] = 'This page does not exists.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}