PDA

View Full Version : theExchangeProject is Now osCommerce...


heru000
12-20-2001, 09:13 AM
They've changed the name - but now I have a problem.... maybe someone here can help.

The validation.php checks the email address for 'form' validity - unfortunately I have a client who has a customer with an apostrophe in the email address - which is getting kicked out during the validation process. I've tried putting in the ' or \' in the $valid_chars field, but to no avail.

Customer claims they use it with other on line stores and no problem - evidently they aren't validating or know something I'm too dumb to figure out.

Any suggestions would be nice. Otherwise I'm setting everything to 'true' .

I'm going to attache the file - changing the extension to .txt from .php - ya know how it is....

Thanks!!

Stoker
12-20-2001, 11:41 AM
I am no regex expert.. here is my best shot, I didnt try any of this, maybe I'll do that later;
as far as I can see the final username-part-of-email validation regex looks like /^[^] \(\)<>@,;:\.\\\"\[]+|(\"[^\"]*\")(\.[^] \(\)<>@,;:\.\\\"\[]+|(\"[^\"]*\"))*$/

As far as I can read it $valid_chars really contains a regex to check for NOT the inserted chars. [^notthese]
I am a little confused about the [^]....] part in $valid_chars, I would have escaped the bracket like [^\]....] I think that is what they intend there anyway, I would also have replaced the inserted space with a \s to catch any whitespace.
So to me it looks like you can use everything but these: ], spaces, (, ) , <, >, @, comma, ;, :, dot, \, ", [
It seems that apostrophe is not banned, so I am not sure why that wouldn't work?

On the other hand, it seems that they accept quoted usernames as welll, where anything exept quotes ("), even nothing, is allowed within, so you could try "Weirdo'User^&$#!name*stuff"@domain.tld
I wonder if an address like that would actually reach its destination? :)

Myself I validate e-mail addresses on a much simpler level, I would explicit allow stuff instead of denying other stuff, if someone has an address with an apostroph I would tell them to fax me their order, or email directly...

I would have made $user_pat something more like
/^[a-zA-Z0-9\-\.\_]+$/

or to include apostroph it could be
/^[a-zA-Z0-9\-\.\_\']+$/

this is untested, I might have forgotten stuff there.. also I am not a regex guru at all so there might be parts of the regex' from that script I don't understand the right way...

*good luck* :-)