Chicano
02-13-2003, 03:02 AM
Ok, I have this tiny script, which will basically check to see if a file exists on my server - if it does exist, it returns with an "Online" if it dosnt (Or if it cannot find the file actually) It returns with an "Offline" ... this is so, on my webpage, I can let people know when my server is online or offline - automatically.
The script worked fine, then, suddenly, it stopped working ... I really don't think I have modified it at all.
(I have it in a little iframe on my main page)
So, this is the page with the script:
<html>
<head>
<style>
body {background:black;color:orange}
#Off {color:red;text-align:center}
#On {color:lime;text-align:center}
</style>
</head>
<body topmargin="0" leftmargin="0">
<center>
<h2>
<?php
$file = @fopen("ftp://testserver:servertest@myserver.address.org/test.html", "r");
if (!$file) {
echo '<b id=Off> Offline</b>';
exit;
}else{
echo '<b id=On> Online</b>';
}
?>
</body>
</html>
It DOES return an "Online" when the server is online -- it just dosnt return the Offline when the server is offline.
Any help greatly appreciated!!!
(btw, originally, I had it as
$file = fopen
but, it returned a text error saying that test.html could not be found or something, so, I was told to put the @ efore the fopen so it wouldnt return any error)
The script worked fine, then, suddenly, it stopped working ... I really don't think I have modified it at all.
(I have it in a little iframe on my main page)
So, this is the page with the script:
<html>
<head>
<style>
body {background:black;color:orange}
#Off {color:red;text-align:center}
#On {color:lime;text-align:center}
</style>
</head>
<body topmargin="0" leftmargin="0">
<center>
<h2>
<?php
$file = @fopen("ftp://testserver:servertest@myserver.address.org/test.html", "r");
if (!$file) {
echo '<b id=Off> Offline</b>';
exit;
}else{
echo '<b id=On> Online</b>';
}
?>
</body>
</html>
It DOES return an "Online" when the server is online -- it just dosnt return the Offline when the server is offline.
Any help greatly appreciated!!!
(btw, originally, I had it as
$file = fopen
but, it returned a text error saying that test.html could not be found or something, so, I was told to put the @ efore the fopen so it wouldnt return any error)