function maintenance($mode = FALSE){ if($mode){ if(basename($_SERVER['SCRIPT_FILENAME']) != 'maintenance.php'){ header("Location: http://example.com/maintenance.php"); exit; } }else{ if(basename($_SERVER['SCRIPT_FILENAME']) == 'maintenance.php'){ header("Location: http://example.com/"); exit; } } }