Dane Posted November 25, 2007 Share Posted November 25, 2007 Hey guys. I want an option on my website were if i goto my admin control pannel and say set `website_online` ONLINE or OFFLINE Would the best way to show my website being online or offline be to put something like this at the top of the page? <?php session_start(); SELECT FROM blah WHERE `website_online` = blah if $website_online == 'OFFLINE' echo 'dont show' else { rest of page here } Is there a better way of doing this? Thanks Dane Quote Link to comment Share on other sites More sharing options...
willpower Posted November 25, 2007 Share Posted November 25, 2007 I don't know if there is a better way, but this is the way i'd go at it. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 25, 2007 Share Posted November 25, 2007 Thats about the only way of doing it. Of course, if you want to show the error message on any page when the website is offline, then you'd be better off storing this: <?php //connect to datase $sql = "SELECT `website_online` FROM `yourtable`"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_row($result); if($row[0] == 'OFFLINE'){ echo 'Website is currently offline'; exit;//stop running the rest of the script } ?> In a file, and requiring it in every page. Quote Link to comment Share on other sites More sharing options...
Dane Posted November 25, 2007 Author Share Posted November 25, 2007 awesome, thanks for your responses. Quote Link to comment 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.