// Get the date in string with Y-m-d format
$exp_date_s = "2013-04-22";
$today_s = date("Y-m-d");
// Convert the dates into timestamp
$exp_date = strtotime($exp_date_s);
$today = strtotime($today_s);
// Compare the timestamp
if ($exp_date > $today) {
// Not yet expired
} else {
// Expired
}
Sometimes you may have multiple domains which you want to use for your website or web application. Probably you needed to park the domains on your hosting cpanel. In this case, you website or web application could be access by more than one domain which is not good for SEO and other 3rd party services may not work.
A simple way to redirect all URLs to a specific URLs is by .htaccess.
Suppose you have the following sub domains and all of them serve your website or web application.
// Assume you have a date string which is in d-m-Y format.
$date_string = '18-04-2013';
// Create the DateTime object
$date = date_create_from_format('d-m-Y', $date_string);
// Print the date in Y-m-d format.
print date('Y-m-d', $date->getTimestamp());
HTTP Authentication is the easiest way to prevent anonymous user access to your website. If you are on Apache, you can refer to the following post. .htaccess – Setting Password For Your Web Folder