summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--account.php4
-rw-r--r--includes/function.inc8
2 files changed, 10 insertions, 2 deletions
diff --git a/account.php b/account.php
index 3146e7f95..1e96f1f9d 100644
--- a/account.php
+++ b/account.php
@@ -296,8 +296,8 @@ function account_user($uname) {
function account_validate($user) {
// Verify username and e-mail address:
- if (empty($user[real_email]) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $user[real_email]))) $error = t("the e-mail address '$user[real_email]' is not valid");
- if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $error = t("the username '$user[userid]' is not valid");
+ if (empty($user[real_email]) || (!check_mail($user[real_email]))) $error = t("the e-mail address '$user[real_email]' is not valid");
+ if (empty($user[userid]) || (!check_name($user[userid]))) $error = t("the username '$user[userid]' is not valid");
if (strlen($user[userid]) > 15) $error = t("the username '$user[userid]' is too long: it must be less than 15 characters");
// Check to see whether the username or e-mail address are banned:
diff --git a/includes/function.inc b/includes/function.inc
index 8a2a73604..fe792d43c 100644
--- a/includes/function.inc
+++ b/includes/function.inc
@@ -28,6 +28,14 @@ function check_code($message) {
return $message;
}
+function check_mail($mail) {
+ return eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $mail) ? 1 : 0;
+}
+
+function check_name($name) {
+ return ereg("[^a-zA-Z0-9_-]", $name) ? 0 : 1;
+}
+
function check_output($message, $nl2br = 0) {
global $allowed_html, $na;
$var = strip_tags(stripslashes(format_text($message)), $allowed_html);