Jump to content

[SOLVED] Making a maintenance script


adamjones

Recommended Posts

Hi,

 

I was wondering anyone could help make a maintenance script, or give a ink to one.

 

Basically, i want to add something like;

 

<?

if(! maintenance == 1}

header("location:maintenance.php");

}

?>

 

To the top of my pages, and I would like to turn maintenance on or off, through an external file. Therefore, if it's set to 1, then it would redirect the user to maintenance.php, and if its set to anything else, it wouldn't redirect. If that makes sense?

 

Any help on this would be great!

Cheers.

Link to comment
Share on other sites

there are many ways of doing this... but yes, the most simple way would be to add

 

if(MAINTENANCE == true) {
   header('location:maintenance.php');
   die();
}

 

to the top of every page or to a bootstrap file and then have somewhere above that, also likely on a bootstrap file...

 

define('MAINTENANCE', true); // or false

 

you can manually change.

 

of course most requirements for maintenance are much more complicated than that, but it's a good starting point.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.