Webman | Salut,
Voila j'ai un problème avec un script PHP, c'est pour vérifier que mes serveur FTP et HTTP sont bien online. seulement ce script ne fonctionne pas chez moi.
Voila ce qu'on m'a dis sur S&R tout à l'heure:
[i]"En php3, quand tu as un passage de paramètre dans l'URL (...script.php3?param=valeur), tu as une variable $param directement accessible dans le code.
C'est encore possible en php 4, à condition de l'activer (paramètre dans le fichier de configuration). Je suis pas sur qu'il le soit par défaut.
Même chose pour les paramètres recus par formulaire ou par sessions.""
Maintenant voila la page HTML associée au script:
Code :
- <html>
- <head>
- <title>Web Server Status</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body bgcolor="#FFFFFF">
- <table border="0" cellspacing="0" cellpadding="3">
- <tr>
- <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">Microsoft.com</font></td>
- <td width="23%"><img src="status.php?link=mon_serveur" width="37" height="20"></td>
- </tr>
- <tr>
- <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">Apple.com</font></td>
- <td width="23%"><img src="status.php?link=mon_serveur" width="37" height="20"></td>
- </tr>
- <tr>
- <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">RedHat.com</font></td>
- <td width="23%"><img src="status.php?link=mon_serveur" width="37" height="20"></td>
- </tr>
- <tr>
- <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">Google.com</font></td>
- <td width="23%"><img src="status.php?link=mon_serveur" width="37" height="20"></td>
- </tr>
- </table>
- </body>
- </html>
|
J'ai bien entendu remplacé "mon_serveur" par l'adresse de mon serveur.
Maintenant voila le fichier .php
Code :
- <?php
- //Web Server Status v 1.2, Copyright 2002 By Ryan Schwiebert, visit http://www.schwebdesigns.com/
- //This script may be freely distributed providing all copyright headers are kept intact.
- //Concept from:
- //Abax Server Status v1.04, Copyright 2002 By Nathan Dickman, visit http://www.NathanDickman.com/
- //Location of the live or dead server images
- //Please change to your server specifications
- $live = "http://mon_serveur/live.gif";
- $dead = "http://mon_serveur/dead.gif";
- //The status checking script
- //meddle at your own risk!
- //check for port number, default is 80
- list($addr,$port)= explode (':',"$link" );
- if (empty($port)){
- $port = 80;
- }
- //Test the server connection
- $churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
- if (!$churl){
- header("Location: $dead" );
- }
- else {
- header("Location: $live" );
- }
- function server($addr){
- if(strstr($addr,"/" )){$addr = substr($addr, 0, strpos($addr, "/" ));}
- return $addr;
- }
- ?>
|
En fait la page s'affiche mais le script ne marche pas... j'ai pas d'info sur l'etat de mes serveurs. Pensez vous que cela vienne du problème dont on m'a parlé ? Si oui comment le résoudre ?
Message édité par Webman le 07-03-2003 à 00:38:09
|