Jump to content

[SOLVED] Maintenance page


rofl90

Recommended Posts

Na i mean on each page of my site, in my admin panel i can add an option to set the thing offline/online etc i have an option with stops mysql, for debbuging, but not to actually change the page it only doesn't function properly,  i need to have an option in admin panel, and i know what it would do at the top of the page eg if a alue is die() etc.. but i don't know the code sorry, im a bit new to PHP..

Why not use a database, then in your normal header check whether or not the value of the maintenance variable is set to 0, if it is, then the page should die before printing any code, or, print code that will display a maintenance notification, if it isn't, print the page normally...this is what I would do.

Everyone on this forum is brilliant, but for 9 out of 10 questions, Super administrators are the only that answer perfectly ;P

fwrite works fine.. I don't know that much about functions and arrays, so I can't just think 'AHA use that function ect'

Thanks again,

Charlie

 

Heres my FINAL code:

<?php
$config = 'config.php';
$offline_var = 1;

if (is_writable($config)) {

  if (!$handle = fopen($config, 'a')) {
        echo "Cannot open file ($config)";
        exit;
  }

  if (fwrite($handle, $offline_var) === FALSE) {
      echo "Cannot write to file ($conig)";
      exit;
  }

  echo "Success, wrote ($offline_var) to file ($config)";

  fclose($handle);

} else {
  echo "The file $config is not writable";
}
?> 

Looking to orange ugh whats wrong with it guys?

Config.php

$mosConfig_offline = '1';
$mosConfig_offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';

header.php

<?php require ("includes/config.php") ?>
<?php global $offline_variable;
if ($offline_variable == 1) {
echo( '$mosConfig_offline_message' );
}
?>

errm it doesn't work hwo do i kill the rest of the page

Archived

This topic is now archived and is closed to further replies.

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