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
https://forums.phpfreaks.com/topic/95031-maintenance-page/
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
https://forums.phpfreaks.com/topic/95031-maintenance-page/#findComment-486791
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
https://forums.phpfreaks.com/topic/95031-maintenance-page/#findComment-486813
Share on other sites

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.