www.webdeveloper.com
Results 1 to 3 of 3

Thread: Code for site under maintenance

  1. #1
    Join Date
    May 2010
    Posts
    1

    Question Code for site under maintenance

    Hi,
    I decided to place the question under General since I am open to any code or idea. I am building a site and I need to be able to work on it without shocking readers with all the "surgery" going on. I need an easy yet safe recommendation for a login prompt when the site is under maintenance.

    In other words, each time I need to work on the site just insert a line of code to show a screen to visitors that says the site is under maintenance and a login prompt (of course inserting the correct login will allow me to view the site and work on it). I have no problem with the css but rather javascript or php. Appreciate any help I can get and thank you for reading.

  2. #2
    Join Date
    Jan 2004
    Location
    Holland
    Posts
    111
    What you probably need is some sort of "splash" page.
    A splash page is a sort of preview of the site, often with an "Enter Site" button somewhere obvious.
    You can have a splash page where you can add a line for maintenance.

    <?php
    $maintenance = 0; // set to 1 while under maintenance
    if($maintenance == 1){
    header("location: login.php");
    } else {
    header("location: home.php");
    }
    exit;
    ?>

    Note that this solution isn't perfect, and it's extremely basic, so it should only be used for a small site.

  3. #3
    Join Date
    Feb 2011
    Posts
    1
    I was in the same situation before.
    My site was in php so I used this code:
    <?php
    included 'isDebugOn.php';
    if ($debug) {
    echo "Site Is Temporarily Unavailable";
    else {
    //regular site code
    }
    ?>

    the advantage with this code is that you can just change the $debug variable in isDebugOn.php and to update the site.

    Hope it helps.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles