Commit c5ef1a5db27904bf2271bc9e4f159e3b79a0163e

Authored by Elena.Budnik
1 parent 796af6ba

ereg => preg_match

Showing 2 changed files with 8 additions and 8 deletions   Show diff stats
index.html
... ... @@ -63,12 +63,12 @@
63 63 })(window.location.search.substr(1).split('&'));
64 64  
65 65 if (qs["error"] && qs["error"] == "1") {
66   - alert('Cannot connect to AMDA');
  66 + alert('Cannot connect to AMDA. \n Please check your username/password');
  67 + setLoginLoader(false);
67 68 return false;
68 69 }
69 70  
70 71 setLoginLoader(false);
71   -
72 72 };
73 73 </script>
74 74 <a href="mailto:amda@irap.omp.eu?subject=AMDA registration" id="Btn_Register"></a>
... ...
php/classes/UserMgr.php
... ... @@ -714,34 +714,34 @@ class UserMgr
714 714 return $wsSize;
715 715 }
716 716  
717   - // http://www.ilovejackdaniels.com/php/email-address-validation/
  717 + // http://www.ilovejackdaniels.com/php/email-address-validation/
718 718 public function check_email_address($email)
719 719 {
720 720 // First, we check that there's one @ symbol, and that the lengths are right
721   - if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email))
  721 + if (!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email))
722 722 {
723 723 // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
724 724 return false;
725 725 }
726   -
  726 +
727 727 // Split it into sections to make life easier
728 728 $email_array = explode("@", $email);
729 729 $local_array = explode(".", $email_array[0]);
730 730 for ($i = 0; $i < sizeof($local_array); $i++)
731 731 {
732   - if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
  732 + if (!preg_match("@^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$@", $local_array[$i])) {
733 733 return false;
734 734 }
735 735 }
736 736  
737   - if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
  737 + if (!preg_match("/^\[?[0-9\.]+\]?$/", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
738 738 $domain_array = explode(".", $email_array[1]);
739 739 if (sizeof($domain_array) < 2) {
740 740 return false; // Not enough parts to domain
741 741 }
742 742 for ($i = 0; $i < sizeof($domain_array); $i++)
743 743 {
744   - if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
  744 + if (!preg_match("/^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$/", $domain_array[$i])) {
745 745 return false;
746 746 }
747 747 }
... ...