From 8bc7ad4383452b2a3872aea3ef7c3eaef675af3b Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 14 Nov 2008 14:38:55 +0000 Subject: Bug fix: correct XSS problems (prevent username with non-alphanumeric characters, protect profile page) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@157 b3834d28-1941-0410-a4f8-b48e95affb8f --- services/userservice.php | 5 +++-- templates/editprofile.tpl.php | 2 +- templates/profile.tpl.php | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/userservice.php b/services/userservice.php index e50faaa..9b295da 100644 --- a/services/userservice.php +++ b/services/userservice.php @@ -393,8 +393,9 @@ class UserService { if (strlen($username) > 24) { // too long usernames are cut by database and may cause bugs when compared return false; - } else { - return true; + } elseif (preg_match('/(\W)/', $username) > 0) { + // forbidden non-alphanumeric characters + return false; } return true; } diff --git a/templates/editprofile.tpl.php b/templates/editprofile.tpl.php index c9eb8a4..a38dbd8 100644 --- a/templates/editprofile.tpl.php +++ b/templates/editprofile.tpl.php @@ -40,7 +40,7 @@ $this->includeTemplate($GLOBALS['top_include']); - + diff --git a/templates/profile.tpl.php b/templates/profile.tpl.php index d7ace7e..ecfadbb 100644 --- a/templates/profile.tpl.php +++ b/templates/profile.tpl.php @@ -10,13 +10,13 @@ $this->includeTemplate($GLOBALS['top_include']); if ($row['name'] != "") { ?>
-
+
-
+
-- cgit v1.2.3