It is currently Thu Mar 28, 2024 8:55 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Website Status page
PostPosted: Wed Jul 04, 2007 6:40 pm 
Newbie
Newbie

Joined: Thu Jun 28, 2007 5:11 pm
Posts: 34
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 18, 2007 5:43 pm 
Getting Started
Getting Started

Joined: Sun Jul 15, 2007 12:06 pm
Posts: 59
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;
}
?>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 18, 2007 6:28 pm 
Getting Started
Getting Started

Joined: Sun Jul 15, 2007 12:06 pm
Posts: 59
<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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 18, 2007 6:34 pm 
Getting Started
Getting Started

Joined: Sun Jul 15, 2007 12:06 pm
Posts: 59
<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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 19, 2007 6:17 am 
Moderator
Moderator

Joined: Tue Feb 27, 2007 12:18 am
Posts: 521
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

_________________
http://www.mjmclocks.co.uk


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011