• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2880
  • Last Modified:

Verify Credit Card Expiry date as VALID

Hi,

I need to verify 2 input fields for validation.
I have a site where clients input their credit card information in the following manner
credit card number: text box
expiry month: drop menu
expiry year: drop menu

The values are place in the database as follows:
Field CC_NUMBER
Field CC_EXP_MONTH
Field CC_EXP_YEAR

My Question,

How can I verify that the credit card being added by the client is NOT expired, BY checking the values of the CC_EXP_MONTH and CC_EXP_YEAR, vs the current date

I use ASP and VB on a SQL 2000 Database

Thanks
Steve

0
TO_Steve
Asked:
TO_Steve
  • 2
1 Solution
 
fozyletCommented:
ExpiryDate = DateSerial(CC_EXP_YEAR,CC_EXP_MONTH,1)
If DateDiff("d",Date,ExpiryDate)<0 Then
    'Card expired...
Else
    'Card valid
End If
0
 
fozyletCommented:
If last day of the expiry month is the date until which the card works, do this...

ExpiryDate = DateSerial(CC_EXP_YEAR,CC_EXP_MONTH+1,0)

this will return the last day of the month. rest is the same...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now