Jump to content

Suggestions please--Site Maintenance page


Recommended Posts

Hey--it's me again :D

 

I'm hoping you guys could give me a few suggestions on how I could do this.

My end-goal is to show a "Maintenance in progress" or such page when I'm currently copying over files, etc, instead of the normal page someone would be viewing (no matter what page that would be).

 

This is how I was thinking of doing it:

 

/control/status.ini:

;; Site Status file
; status = 'maintenance' -- the website is down
; status = 'green' -- the site is fine.
;; TODO:
; reason = 'We are updating a bug in blah blah blah' -- specify some more information to show up on the "Site under Maintenance" page.
status = 'maintenance'

 

 

/control/maintenance.php:

<?php
    //Maintenance.php

    echo 'SITE IS DOWN';

$?>

 

/index.php (or any file for that matter):

<?php
    $ini_array = parse_ini_file("/control/status.ini");
    print_r($status_array);

    if ($status_array['status'] == "maintenance") {
        header('Location: http://unorthodox.co.cc/control/maintenance.php');
    } else {
        //Normal page
    }
?>

 

 

In a nutshell, everytime a page is loaded, the page will check /control/status.ini, and if "status" equals "maintenance", it will only show "SITE IS DOWN". Otherwise, nothing will change.

 

Drawbacks are, that everytime a page is loaded, status.ini will have to be checked. Also, if you wanted to put the site under "maintenance", you would have to edit the status.ini and FTP it, and the same if you wanted to take it down from maintenance.

 

 

So what are your thoughts? (Not involving code,) How could I improve this (using a database, or checking a .ini on my own computer...?).

 

Thanks.

~Derek

Link to comment
Share on other sites

On your site, you could give yourself a sort of an "Admin Control Panel" and have a boolean in a mySQL table, and when you want it to be under maitenence, you set it to "true" (via a checkbox in your ACP), otherwise, it's a "false".

 

That sounds like a good idea. A lot better than mine xD. I'm still thinking about it though, but I think what I end up doing is very similar to your idea.

Link to comment
Share on other sites

You could also use .htaccess to redirect all requests to another page.

 

Wow, I can't believe I didn't think of that >.> It's simple but it still does exactly what I needed.

 

I think I'm going to do what both of you suggested--I'm going to make an AdminCP and one of the things I can do is I can change the .htaccess files with the maintenance page (except my /admin directory). EDIT: Or I can just do it in cPanel. *shrug* </EDIT>

 

 

Thanks,

~Derek

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...