Re: [PHP] global address collection



On Jan 8, 2008 10:08 AM, tedd <tedd.sperling@xxxxxxxxx> wrote:
I just finished a credit card portion for a site where the programmer
before me required the customers to enter their credit card number
without spaces -- why? It's a simple matter to remove spaces for
processing -- why throw that responsibility on the user?

I agree that removing spaces really isn't a huge deal, but aside from
that I don't think there should be any other modification. I've seen
code that will regex out anything but numbers. I think this is bad
practice because we as programmers should validate, not modify data.
Anything above and beyond that is sticking your neck out too far and
will lead to problems sooner or later.

What if the user mistyped what they intended? If the script just
validates it will see the user accidently typed in a letter in the
field and re-display it asking for numbers only. If it strips out the
letters, then you've just sent the potentially invalid number to the
gateway which in the end will be a charge against the client for a
failed attempt.
.



Relevant Pages

  • Re: [PHP] global address collection
    ... Generally, don't modify the data provided, but rather validate the form of the data. ... white space is a different critter in some data and is basically used to help customers accurately enter/see their credit card numbers. ... you can check for a valid credit card number prior to sending it out. ...
    (php.general)
  • Re: Marquee For Firefox
    ... This is normal Usenet practice, indeed normal practice in any commenting in writing. ... Deviating from it is a common signal of cluelessness, and I won't do that no matter how much some people might like to have their entire postings quoted. ... No matter how innocent and sensitive and cool and everything you are, you presented an incorrect statement "The mark up cannot validate." ... I will remind the audience that you made an incorrect statement about HTML, indicating that you either don't know what validation is or was very sleepy or sloppy. ...
    (alt.html)
  • Re: CSS ignored in IE.6.0.2800 ?
    ... >> Well, if you validate your code, and it's working on everybody's ... > new functionnalities for the whole intranet (about 180 customers). ... Sonhos vem. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Looking for a certain regexp
    ... None of your syntax will "validate" a credit card. ... match specific mathematical formulas, and produce ...
    (comp.lang.perl.misc)
  • is this a hoax or MS authenication request asking for my credit ca
    ... blindly give out your credit card to an unsolicited email ... >their Windows Operating System. ... If you do not validate your serial number, ...
    (microsoft.public.windowsxp.general)