Author Topic: Site Unavailable Message  (Read 3220 times)

Offline marathoner

  • Posts: 495
Site Unavailable Message
« on: July 07, 2008, 01:28:56 AM »
I've had an 'issue' with one of my clients not paying for services on a timely basis. I decided to implement a little code in the template to make it look like the site is unavailable if the bill is not paid by a certain date. There are probably many ways to make the site look unavailable but I wanted to automate the process so that I didn't have to remember to manually change something. One advantage to this is that nothing on the site is actually disabled and is easily put back on-line by changing the $expiry date.

Here is the code that I inserted at the top of my template index.php file if anyone else wants to use it:
Code: [Select]
// This is the "enforce payment of hosting fees" code
$today = strtotime(date("Y-m-d"));
$expiry = strtotime(date("2008-08-01"));
if ($today >= $expiry) {
$msg = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$msg.='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$msg.='<head><title>Mohican 100</title></head><body>';
$msg.='<p>This site is temporary unavailable due to unpaid hosting fees</p></body></html>';
echo $msg;
exit;
}

Of course, I'll need to remember to change the date if they really do pay by the due date!

 

postern-length