This function will redirect your visitors if your site is going under maintenance.
Keep this function out of your main template files, but in a file which is always included. For example a php file which is always included in your header.
function maintenance($M_mode, $Redirect)
{
if ($M_mode === true)
{
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if (trim($url) != trim($Redirect))
{
header('Location:'.trim($Redirect));
}
}
}
How to use
Include this function somewhere in your header, or at least a included/required file which always will be called so no backdoors are open.
// $M_mode must be false if your website is online, set to true if you are busy with maintenance // $Redirect url to redirect to maintenance($M_mode = false, $Redirect = 'http://localhost/maintenance/sorry.php');
Mail this!
- Comments (0)
- PingBacks (0)
- TrackBacks (0)


» Latest comments