&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; } }
Matt Wright - mattw@scriptarchive.com |