From a6e6dfb9219ebea34331ad46c9c43d53f7c3ca6f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 19 Apr 2001 19:54:37 +0000 Subject: - Addition: added 2 new functions check_mail() and check_name() to functions.inc useful for resp. verifying an e-mail address and username: currently used by account.php - but reusable by Julian's refer.module for example (prepares integration). --- includes/function.inc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'includes') 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); -- cgit v1.2.3