Jump to content

Recommended Posts

How do you mean?

Like have a header and body page?

 

<?php
session_start();
echo "Header";
echo "<table><tr><td>";
include "Menu.php";
echo "</td></td><td>";
then at the end of the body pages just put: 
echo "</td></tr></table>";

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.