Changeset 2115 for trunk/include/functions_user.inc.php
- Timestamp:
- Oct 2, 2007, 12:07:47 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r2084 r2115 25 25 // +-----------------------------------------------------------------------+ 26 26 27 // validate_mail_address verifies whether the given mail address has the 28 // right format. ie someone@domain.com "someone" can contain ".", "-" or 29 // even "_". Exactly as "domain". The extension doesn't have to be 30 // "com". The mail address can also be empty. 27 // validate_mail_address: 28 // o verifies whether the given mail address has the 29 // right format. ie someone@domain.com "someone" can contain ".", "-" or 30 // even "_". Exactly as "domain". The extension doesn't have to be 31 // "com". The mail address can also be empty. 32 // o check if address could be empty 33 // o check if address is not used by a other user 31 34 // If the mail address doesn't correspond, an error message is returned. 32 function validate_mail_address( $mail_address ) 33 { 34 global $lang, $conf; 35 // 36 function validate_mail_address($mail_address) 37 { 38 global $conf; 35 39 36 40 if (empty($mail_address) and … … 39 43 return ''; 40 44 } 45 41 46 $regex = '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.[a-z]+$/'; 42 47 if ( !preg_match( $regex, $mail_address ) ) 43 48 { 44 return $lang['reg_err_mail_address']; 49 return l10n('reg_err_mail_address'); 50 } 51 52 if (defined("PHPWG_INSTALLED") and !empty($mail_address)) 53 { 54 $query = ' 55 select count(*) 56 from '.USERS_TABLE.' 57 where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\') 58 ;'; 59 list($count) = mysql_fetch_array(pwg_query($query)); 60 if ($count != 0) 61 { 62 return l10n('reg_err_mail_address_dbl'); 63 } 45 64 } 46 65 } … … 48 67 function register_user($login, $password, $mail_address, $errors = array()) 49 68 { 50 global $ lang, $conf;69 global $conf; 51 70 52 71 if ($login == '') 53 72 { 54 array_push($errors, $lang['reg_err_login1']);73 array_push($errors, l10n('reg_err_login1')); 55 74 } 56 75 if (ereg("^.* $", $login)) 57 76 { 58 array_push($errors, $lang['reg_err_login2']);77 array_push($errors, l10n('reg_err_login2')); 59 78 } 60 79 if (ereg("^ .*$", $login)) 61 80 { 62 array_push($errors, $lang['reg_err_login3']);81 array_push($errors, l10n('reg_err_login3')); 63 82 } 64 83 if (get_userid($login)) 65 84 { 66 array_push($errors, $lang['reg_err_login5']);85 array_push($errors, l10n('reg_err_login5')); 67 86 } 68 87 $mail_error = validate_mail_address($mail_address);
Note: See TracChangeset
for help on using the changeset viewer.