Jump to content

Maintenance Page


rofl90

Recommended Posts

How would you go about turning off your website, I mean I already have an option in my backend to specify maintenance, but to have it on each page as opposed to the outdated index, index2, mechanism, to check if the user is authenticated, and if not kill the script, but how would I do that without doubling my code, and inturn doubling my load time.

Link to comment
Share on other sites

depends how u store the switching of site on/off line..

 

easiest is prollly mysql, using a table for yer vars...

 

CREATE TABLE `vars` (
  `name` varchar(32) NOT NULL default '',
  `i` int(10) NOT NULL default '0',
  `u` int(10) unsigned NOT NULL default '0',
  `f` double NOT NULL default '0',
  `s` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`name`)
) ENGINE=MyISAM; 

 

than ya can add a switching system in the admin page

 

on login, ya want to check this value, if admin or other special case users allow it, otherwise deny the user.

 

 

Link to comment
Share on other sites

got it working

<?php
session_start();
require("inc/connectdb.php");
$thequery= "SELECT * FROM settings";
$maintenancequery = mysql_query($thequery) or die(mysql_error());
$settings = mysql_fetch_array($maintenancequery);
$siteonline = $settings['maintenance'];
if($siteonline == '0' && $_SESSION["access"] != 'granted') {
header("Location: http://www.codeetech.com/maintenance.php");
}
else
{
//blablabla
}
?>

Link to comment
Share on other sites

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.