Hey Mathieu,

On Wed, Sep 08, 2004 at 06:41:13PM +0200, Mathieu Roy wrote:
> 
> Hi Elfyn,
> 
> You have an extra dot at the end of your email at Gna!
>     [EMAIL PROTECTED]

Thanks for letting me know!  I have fixed it.

> I wonder how it was possible for you to validate such an address.

Hrmm.. the regex in validate_email() allow's for a dot in the hostname part but
doesn't exclude it from being at the end.  Instead of compilcating the regex
rurther, how about adding a check for a leading dot?  (Patch attached.)

Elfyn

-- 
Elfyn McBratney
beu on irc.freenode.net/savannah.[non]gnu.org

PGP Key ID: 0x456548B4
PGP Key Fingerprint:
  29D5 91BB 8748 7CC9 650F 31FE 6888 0C2A 4565 48B4
Index: include/utils.php
===================================================================
RCS file: /cvs/savane/savane/frontend/php/include/utils.php,v
retrieving revision 1.63
diff -u -p -b -B -r1.63 utils.php
--- include/utils.php   30 Jun 2004 14:10:51 -0000      1.63
+++ include/utils.php   9 Sep 2004 19:26:54 -0000
@@ -780,7 +780,10 @@ function utils_split_emails($addresses)
 # Email Verification
 function validate_email ($address)
 {
-  return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. 
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . 
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $address));
+  if (substr($address, -1, 1) != '.')
+    {
+      return ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. 
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . 
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $address);
+    }
 }
 
 # Verification of comma separated list of email addresses

Attachment: pgpQ6RNdHumwB.pgp
Description: PGP signature

Reply via email to