function _valid_card_expiration in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_credit/uc_credit.module \_valid_card_expiration()
Validates an expiration date on a card.
Parameters
$month: The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12.
$year: The 4-digit numeric representation of the year, i.e. 2008.
Return value
TRUE for non-expired cards, FALSE for expired.
1 call to _valid_card_expiration()
- uc_payment_method_credit in payment/uc_credit/ uc_credit.module 
File
- payment/uc_credit/ uc_credit.module, line 1739 
- Defines the credit card payment method and hooks in payment gateways.
Code
function _valid_card_expiration($month, $year) {
  if ($year < date('Y')) {
    return FALSE;
  }
  else {
    if ($year == date('Y')) {
      if ($month < date('n')) {
        return FALSE;
      }
    }
  }
  return TRUE;
}