rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: dardarlt on February 26, 2007, 09:52:25 PM
-
My hfs site is not always online.
Is it possible to create like a gateway page like www.parent.com, where from I could simplye redirect to my hfs site if it is online and simply give a message like "visit later. page is offline temporary".
Or is it any other smart solution to that?
-
to make something like that, you need to have 2 server.
the second computer should be online when the first is offline.
do you have such thing?
-
well, hi guys! im slowly getting back to my old life with some free time, and lately im playing with php, and saw this question, in php i create a small status window in php wich tells me if my pages/web-services are running ok.
my hfs at home i check with this code
<?php
if(fsockopen('ledufe.no-ip.info', 2222, $errno, $errstr, 5) !== false)
{
echo 'HFS' . " Online!";
}
else
{
echo 'HFS' . " Offline!";
}
?>
hope it helps
i also got a way to do this in javascript using xmlhttp request, and it works too, but since there are so many paranoics people that dont trust in javascript, i prefer to not use it...
-
well, hi guys! im slowly getting back to my old life with some free time, and lately im playing with php, and saw this question, in php i create a small status window in php wich tells me if my pages/web-services are running ok.
my hfs at home i check with this code
<?php
if(fsockopen('ledufe.no-ip.info', 2222, $errno, $errstr, 5) !== false)
{
echo 'HFS' . " Online!";
}
else
{
echo 'HFS' . " Offline!";
}
?>
hope it helps
i also got a way to do this in javascript using xmlhttp request, and it works too, but since there are so many paranoics people that dont trust in javascript, i prefer to not use it...
where do you put this code or the file with it? And how does it work?
-
well, hi guys! im slowly getting back to my old life with some free time, and lately im playing with php, and saw this question, in php i create a small status window in php wich tells me if my pages/web-services are running ok.
my hfs at home i check with this code
<?php
if(fsockopen('ledufe.no-ip.info', 2222, $errno, $errstr, 5) !== false)
{
echo 'HFS' . " Online!";
}
else
{
echo 'HFS' . " Offline!";
}
?>
hope it helps
i also got a way to do this in javascript using xmlhttp request, and it works too, but since there are so many paranoics people that dont trust in javascript, i prefer to not use it...
Welcome back! :D
Can you post the one that uses javascript aswell? Cause i might be interested in it^^
I'm not afraid of javascript at all.. in fact, if javascript is disabled, HFS Terayon will only work for 50%. Just like most other pages found on the internet.
-
My hfs site is not always online.
Is it possible to create like a gateway page like www.parent.com, where from I could simplye redirect to my hfs site if it is online and simply give a message like "visit later. page is offline temporary".
Or is it any other smart solution to that?
You can use DynDns to do that http://www.dyndns.com.
-
rejeto well understood the problem and ledufe gave an answer - I'll try it.
Yes, I have second server. But I didn't suceeded writing my own php script.
I'll writte after the try
-
<?php
if(fsockopen('ledufe.no-ip.info', 2222, $errno, $errstr, 5) !== false)
{
echo 'HFS' . " Online!";
}
else
{
echo 'HFS' . " Offline!";
}
?>
This works- thank you very much - this is what I needed!
Just I think better to use @fsockopen instead of fsockopen (I've got a warning message using it).
-
in parts - hahah
to dardarlt
thanks, im glad that it worked for you.... and also, im not getting this warning becouse of my php.ini config, in mine im using like this
error_reporting = E_ALL
instead the normal/original one:
error_reporting = E_ALL & ~E_NOTICE
to the Giant Eagle
about the javascript code is
<script type="text/javascript" language="javascript">
var http_request = false;
function makeRequest(url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
// See note below about this line
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('GET', url, true);
http_request.send(null);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
alert(http_request.responseText);
} else {
alert('There was a problem with the request.');
}
}
}
</script>
<span
style="cursor: pointer; text-decoration: underline"
onclick="makeRequest('test.html')">
Make a request
</span>
the onlydrawback to the javascript it is that he looks for a specific file somewhere in the hfs filesystem in this case it looks to a file called test.html
well i don“t know much of javascript, but that_stevens_guy and flyns are very good with js, im getting the way with php now...
if you need some of my help or just to talk about codes and some tech stuffs, let me know....
bye...
-
the onlydrawback to the javascript it is that he looks for a specific file somewhere in the hfs filesystem in this case it looks to a file called test.html
if that's an url, just use as URL the root of HFS. it is like a file, the javascript doesn't know the difference.
-
<?php
/*HFS Status */
error_reporting(0);
if(fsockopen('server_name', port_number, $errno, $errstr, 5) !== false)
{
echo "<a href=\"http://server_name:port_number\">CONNECT</a></p><br><br>"; //If ONLINE
} else {
echo "<font color=\"red\" face=\"verdana\" size=\"2\">OFF</font></p><br><br>"; //If OFFLINE
}
?>
error_reporting(0) - It will switch off PHP error reporting.
It works for me ;D
-
Thnx ledufe!
I'll take a look at it.