We help IT Professionals succeed at work.
Get Started

osCommerce cvv2 validation field

littletipi
littletipi asked
on
947 Views
Last Modified: 2012-05-05
Hello,
I have osCommerce installed on my webserver but i need to make a modification.
I have modified the cc.php payment module and did this

 '    if (cc_cvv2 == "" ) {' . "\n" .
            '      error_message = error_message + "' . MODULE_PAYMENT_CC_CVV2_ERROR . '";' . "\n" .
            '      error = 1;' . "\n" .
            '    }' . "\n" .
 '    if (cc_cvv2.length < 3 || cc_cvv2.length > 4 ) {' . "\n" .
            '      error_message = error_message + "' . MODULE_PAYMENT_CC_CVV2_ERROR_LENGTH . '";' . "\n" .
            '      error = 1;' . "\n" .
            '    }' . "\n" .

It works fine but it just checks if cvv2 field is empty and checks cvv2 min and max length.
i still need if someone gives as Credit Card Type
Visa Master or any other cvv2 Length should be 3
but if someone gives American Express as Credit card type cvv2 length should be 4
So i mean if someone chose American Express as credit card type and gives just 3 numbers it should display error for example:

 define('MODULE_PAYMENT_CC_CVV2_ERROR_AMEX', 'American Express cvv2 should be 4 characters long!');

but if someone chose other card types like visa it should allow just 3 characters not more so if someone gives 2 or 4 it should display error Cvv2 Should be 3 characters long.

Regards.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE