Changeset 15 for trunk/lib/FormValidator.inc.php
- Timestamp:
- Nov 13, 2005 4:51:22 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FormValidator.inc.php
r14 r15 390 390 // Test email address format. 391 391 if ($allow_fullname) { 392 if (!$this->checkRegex($form_name, '/^[\w\s]*<? php[A-Za-z0-9._-]{1,}\@[A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5}>?$/i', true, sprintf(_("<strong>%s</strong> is not a valid email address."), $email))) {392 if (!$this->checkRegex($form_name, '/^[\w\s]*<?[^\s@\[\]<>]{1,}\@[A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5}>?$/i', true, sprintf(_("<strong>%s</strong> is not a valid email address."), $email))) { 393 393 App::logMsg(sprintf('The email address %s is not valid.', getFormData($form_name)), LOG_DEBUG, __FILE__, __LINE__); 394 394 return false; 395 395 } 396 396 } else { 397 if (!$this->checkRegex($form_name, '/^[ A-Za-z0-9._-]{1,}\@[A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5}$/i', true, sprintf(_("<strong>%s</strong> is not a valid email address."), $email))) {397 if (!$this->checkRegex($form_name, '/^[^\s@\[\]<>]{1,}\@[A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5}$/i', true, sprintf(_("<strong>%s</strong> is not a valid email address."), $email))) { 398 398 App::logMsg(sprintf('The email address %s is not valid.', getFormData($form_name)), LOG_DEBUG, __FILE__, __LINE__); 399 399 return false; … … 402 402 403 403 // Test length. 404 if (!$this->stringLength($form_name, 0, 128, sprintf(_("<strong>Email address</strong> must contain less than 128characters."), $email))) {405 App::logMsg(sprintf('The email address %s must contain less than 128characters.', getFormData($form_name)), LOG_DEBUG, __FILE__, __LINE__);404 if (!$this->stringLength($form_name, 0, 255, sprintf(_("<strong>Email address</strong> must contain less than 256 characters."), $email))) { 405 App::logMsg(sprintf('The email address %s must contain less than 256 characters.', getFormData($form_name)), LOG_DEBUG, __FILE__, __LINE__); 406 406 return false; 407 407 } 408 408 409 409 // Check domain exists and has valid MX record. 410 preg_match('/^[\w\s]*<? php[A-Za-z0-9._-]{1,}\@([A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5})>?$/i', $email, $matches);410 preg_match('/^[\w\s]*<?[^\s@\[\]<>]{1,}\@([A-Za-z0-9.-]{1,}\.[A-Za-z]{2,5})>?$/i', $email, $matches); 411 411 if (!empty($matches[1])) { 412 412 if (!checkdnsrr($matches[1] . '.', 'MX') && gethostbyname($matches[1]) == $matches[1]) {
Note: See TracChangeset
for help on using the changeset viewer.