Any php knowledgeable fellows have 2 mins free to help me!

Discussion in 'PHP' started by YooChoob, Mar 8, 2007.

  1. #1
    Hello, ok so i have my website and each page has a header.php include...

    What i want top do is a small line of code that will MAke the page Display

    "This website is currently under maintainece"

    When a box is checked and submitted by another script



    Any ideas how this can be done...... could some 1 whip up a script or point me in the right direction i would be very greatful :D:D:D:


    Cheers guys!
     
    YooChoob, Mar 8, 2007 IP
  2. Lucas3677

    Lucas3677 Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could have the checkbox update a field in the MySQL database and the header file check it to see if it is enabled or not then display the relevant content:

    
    <?php
    
    $query = mysql_query("SELECT `maintenanceOn` FROM `settings` LIMIT 1") or die(mysql_query());
    
    list($maintenanceOn) = mysql_fetch_assoc($query) or die(mysql_query());
    
    if ($mainenanceOn === 1) {
         echo "This website is currently under maintenance";
    } else {
         // not under maintenance. Do something or remove the else {} portion
    }
    
    ?>
    
    PHP:
     
    Lucas3677, Mar 9, 2007 IP