Jump to content

Recommended Posts

Posted

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

Posted

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

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

Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...