eleven0 Posted October 31, 2008 Share Posted October 31, 2008 <?php $status = $_GET["status"]; if (!$status) { echo("this is when everything is working fine"); } else if($status=="1") {echo("This is status 1, it will set to '1' when page is under construction."); } else { echo "<b><h1>404 Error</h1></b>"; } ?> I'm trying to create a control panel for my website. I want to configure couple of modes for certain pages. For instance, lets say that a web page is under construction, I'd be setting the status to 1, which shows my maintenance mode message. But the code I have requires my users to type "?status=1" in the URL to see the message, which is useless. Maybe i can redirect them to "?status=1"? is it possible to control this through a control panel? if so, how? Edit: This is probably not a good way of doing what I want. Because, users can type "status=0" to see the page even though status 1 is set. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/130839-how-to-change-page-apperance-mode-using-php-maintenance-mode/ Share on other sites More sharing options...
redarrow Posted October 31, 2008 Share Posted October 31, 2008 use a header function if need be where the echo is.... <?php $status=1; // set this for the current website status......... switch ($status){ CASE "1": echo"where under construction"; break; CASE "2": echo"mail server down"; break; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/130839-how-to-change-page-apperance-mode-using-php-maintenance-mode/#findComment-679088 Share on other sites More sharing options...
JonnoTheDev Posted October 31, 2008 Share Posted October 31, 2008 Yes, you are correct this is a poor method! You could create an array of all your site files and the status value within a file included on every page. Test the value against the server gloabal PHP_SELF $pageStats['/index.php'] = 0; $pageStats['/page1.php'] = 1; $pageStats['/page2.php'] = 0; $status = $pageStats[$_SERVER['PHP_SELF']]; if($status == 1) { // redirect to under construction page header("Location:construction-page.php"); exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/130839-how-to-change-page-apperance-mode-using-php-maintenance-mode/#findComment-679352 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.