From 2b5c2fdc5c3b83d98ffb67dbcdb70677fb74f62b Mon Sep 17 00:00:00 2001 From: Niko Date: Fri, 11 Feb 2022 01:26:33 +0100 Subject: [PATCH] Create function to validate usernames (by regex) --- web/src/base.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/base.php b/web/src/base.php index 5ea1c8f..0f87d10 100644 --- a/web/src/base.php +++ b/web/src/base.php @@ -73,3 +73,8 @@ function if_session_redirect_app() { if (session() !== null) redirect(APP_DIR); } + + +function validate_username($username) { + return preg_match('/^[a-zA-Z0-9\_]+$/', $username); +}