note 60076 deleted from function.mktime by derick
| From: | derick@php.net | Date: | Sun, 24 Sep 2006 11:51:12 +0000 |
| Subject: | note 60076 deleted from function.mktime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117500@lists.php.net to get a copy of this message | ||
Note Submitter: chris@NnOoSwPhAeMre dot gov
----
<?
/***************
Take a date from a credit card stored in a mysql database and see when it expires based on
today's date.
$row[account_exp] = 1/2006
eg.
echo "$cc_exp_month/$cc_exp_year ($cc_exp_string)"
shows you 1/2006 (7 DAYS)
****************/
list($cc_exp_month,$cc_exp_year) = explode("/", $row[account_exp]);
if ( ( $cc_exp_month && $cc_exp_year ) && ( mktime() >
mktime(0,0,0,$cc_exp_month,1,$cc_exp_year ) ) ) {
$is_expired = TRUE;
$cc_exp_string = "<font color=red>".EXPIRED."</font>";
} elseif ( $cc_exp_month && $cc_exp_year ) {
$is_expired = FALSE;
$time = mktime(0,0,0,$cc_exp_month,1,$cc_exp_year) - mktime();
$time = round($time / (24 * 60 * 60));
$time .= " ".DAYS;
$cc_exp_string = "<font color=green>".$time."</font>";
}