Re: How to detect the Server OS ?
| From: | Alberto Ferrer | Date: | Fri, 13 Jun 2003 15:38:02 +0000 |
| Subject: | Re: How to detect the Server OS ? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3532@lists.php.net to get a copy of this message | ||
Ready is done :)
<?php
/*****************************************************/
/* Barra Home Stop Load v0.1 by Alberto Ferrer */
/* http://www.barrahome.org - albertof@barrahome.org */
/*****************************************************/
function getloadavg () {
if ($fd = fopen('/proc/loadavg', 'r')) {
$results = split(' ', fgets($fd, 4096));
fclose($fd);
} else {
$results = array('N.A.','N.A.','N.A.');
}
return $results;
}
/* http://cvs.php.net/include/loadavg.inc */
function check_load()
{
if (!function_exists("getloadavg")) {
return;
}
$l = getloadavg();
header("X-PHP-Load: " . implode(", ", $l));
if ($l[0] > 2) {
header("HTTP/1.1 503 Too busy, try again later");
/* Variables de configuracion */
/* Sitio a redireccionar cuando hay mas Load */
$BH_SITE = "http://www.barrahome.org";
/* Titulo */
$BH_TITLE = ":: Barra Home :: Anti Load!";
/* Mensaje de espera */
$BH_MSG = "Espere por favor, el servidor esta sobrecargado.";
?>
<html>
<head>
<title><?php echo $BH_TITLE; ?></title>
<SCRIPT LANGUAGE="JavaScript">
function redireccionar() {
setTimeout("location.href='<?php echo $BH_SITE; ?>'", 10000);
}
</SCRIPT>
</head>
<body onLoad="redireccionar()">
<center><?php echo $BH_MSG; ?>.</center>
</body>
</html>
<?
exit;
}
}
if (eregi('WIN',PHP_OS)) {
echo "<center>Plataformas Win32 No estan Soportadas por BHSL</center>";
exit;
}
check_load();
?>
--
----------------------------------------------
Alberto Ferrer
albertof@barrahome.org
http://www.barrahome.org
----------------------------------------------
Syntax Error in KITCHEN.H: COFFEE not found.
"Alberto Ferrer" <albertof@barrahome.org> escribió en el mensaje
news:20030613152951.20769.qmail@pb1.pair.com...
> How to detect the Server OS ?
>
> --
> ----------------------------------------------
> Alberto Ferrer
> albertof@barrahome.org
> http://www.barrahome.org
> ----------------------------------------------
> Syntax Error in KITCHEN.H: COFFEE not found.
>
>