FreeHostia Forums http://forum.freehostia.com/ |
|
Website Status page http://forum.freehostia.com/viewtopic.php?f=10&t=5991 |
Page 1 of 1 |
Author: | askscholey.com [ Wed Jul 04, 2007 6:40 pm ] |
Post subject: | Website Status page |
I have a status page on another website and I am wondering if there is a code to set it to display the online page when my site is online and vice-versa. |
Author: | EasyTec [ Wed Jul 18, 2007 5:43 pm ] |
Post subject: | |
Maybe make a PHP page with a switch. Like: <? $wgWebEnabled = new String(); if ( $wgWebEnabled == 'true' ) { require_once( 'YourPage' ); exit; } if ( $wgWebEnabled == 'false' ) { require_once( 'ErrorPage' ); exit; } ?> |
Author: | EasyTec [ Wed Jul 18, 2007 6:28 pm ] |
Post subject: | |
<title>Waiting</title> <b>Hold on!</b> <? $wgWebEnabled = 'true'; if ( $wgWebEnabled == 'true' ) { require_once( 'index.php' ); } if ( $wgWebEnabled == 'false' ) { require_once( 'error.php' ); } ?> Is better. |
Author: | EasyTec [ Wed Jul 18, 2007 6:34 pm ] |
Post subject: | |
<title>Waiting</title> <b>Hold on!</b> <? $wgWebEnabled = 'true'; if ( $wgWebEnabled == 'true' ) { require_once( 'index.php' ); exit; } if ( $wgWebEnabled == 'false' ) { require_once( 'error.php' ); exit; } ?> The term exit, ends the current stream and lets the other take over. It is like an IFRAME without a frame if you don't close this stream. |
Author: | Josh.Waller [ Thu Jul 19, 2007 6:17 am ] |
Post subject: | |
or you could do it proply because as far as i can see EasyTec's code is not going to work, as at no point it acctualy sees if the connection is open, and it also doesnt need the exit; because it will get to the } and exit. Also a real coder would use an elseif or even an else rather than 2 ifs. This is how i would do it. Code: <?php
$place = "SITE NAME GOES HERE": $fp = fsockopen($place, 80, $errno, $errstr); if (!$fp) { require_once('error.php'); } else { require_once($place . '/place.php'); } ?> Make sure that the other host has fsockets open because many disable them |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |