MSA - Matt's Script Archive
 Matt's Script Archive: Credit Card Verifier: Frequently Asked QuestionsView All FAQs @ MSA
 
  Other sites by Matt:
 FormMail.com
  - hosted form processor


  Matt's Script Archive
    FormMail
    Guestbook
    WWWBoard
    Simple Search
    Counter
    TextCounter
    Random Text
    TextClock
    Free for all Links
    Random Link
    HTTP Cookie Library
    Countdown
    Random Image
    SSI Random Image
    TextCounter C++
    TextClock C++
    Credit Card Verifier
      Readme
      Download
      > FAQ 

Credit Card Verification Frequently Asked Questions
    1. Is there a fix which checks the expiry date?
1. Is there a fix which checks the expiry date?
The following piece of code was submitted by Dave MacRae, and is said to check the expiry date of your credit card, if you pass the date the user entered to the subroutine like:

&CheckExpire($FORM{'cardexp'});

Just put the following subroutine into the script, as well as a call similar to the one above.

sub CheckExpire {

    local ($exp_date) = @_;
    $exp_date =~ s/ //g;
    ($month, $year) = split('/', $exp_date);
    (@thistime) = gmtime(time);
    $thistime[4]++;
    $date = "\"$thistime[5]/$thistime[4]/$thistime[3]:";

    if (length($month) > 2 or length($year) > 2) {
        return 0;
    } elsif ($month < 0 or $month > 12) {
        return 0;
    } elsif ($year < $thistime[5]) {
        return 0;
    } elsif ($year == $thistime[5] and $month < $thistime[4]) {
        return 0;
    } else {
        return 1;
    }
}



 

FormMail.com :: HTML Form to Email Processor
[ Linking to MSA | Advertising Opportunities | Contact Matt ]
© 1995 - 2009 Matt Wright and Matt's Script Archive, Inc.