plasmagames Posted November 30, 2008 Share Posted November 30, 2008 I would like to get a downtime system going, where you(admin) can check a box that enables downtime. When in downtime, if you go to the site it displays a page, that says a message like "Plasma Steel Games is Temporary Down for maintenance" with a liek below that allows admins to login so that you can take it out of Downtime mode. Post if you can help me out. Quote Link to comment https://forums.phpfreaks.com/topic/134831-downtime-system/ Share on other sites More sharing options...
ratcateme Posted November 30, 2008 Share Posted November 30, 2008 you could use .htaccess and redirect user to a special page. if you have a common file included on one page you could make a script to edit it or something and add a say echo "server is down<a href=admin.php>admin</a>"; exit; Scott. Quote Link to comment https://forums.phpfreaks.com/topic/134831-downtime-system/#findComment-702106 Share on other sites More sharing options...
plasmagames Posted December 3, 2008 Author Share Posted December 3, 2008 is that the way smf does it? Quote Link to comment https://forums.phpfreaks.com/topic/134831-downtime-system/#findComment-705200 Share on other sites More sharing options...
DeanWhitehouse Posted December 3, 2008 Share Posted December 3, 2008 For my site i just use a included file in all pages that checks the DB or flat file to see if the site is closed, if so then redirect all page requests to a certain page (unless logged in) and show them the reason it is closed. Quote Link to comment https://forums.phpfreaks.com/topic/134831-downtime-system/#findComment-705219 Share on other sites More sharing options...
elis Posted December 3, 2008 Share Posted December 3, 2008 You'd need to add a table in your db and have a function of some sort that checks against it, and is also included in every page. An untested snippet would probably look like <?php $result = mysql_query("SELECT * FROM tablename") or die(mysql_error()); $row = mysql_fetch_array( $result ); if($row[downtime] == 1) { echo "your downtime message"; } else { your usual site content } ?> An then include the above in an external file on every page. Quote Link to comment https://forums.phpfreaks.com/topic/134831-downtime-system/#findComment-705230 Share on other sites More sharing options...
plasmagames Posted December 4, 2008 Author Share Posted December 4, 2008 could i change the { your usual site content } to { header( 'Location: http://plasmasteelgames.net ) ; } and put all your code in a php file and include it in the config.php file Quote Link to comment https://forums.phpfreaks.com/topic/134831-downtime-system/#findComment-706299 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.