Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Status servera problem, Skrypt sprawdza port 80 a nie 20100
adamshl
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 3.01.2005

Ostrzeżenie: (0%)
-----


Witam wszystkich, mam taki skrypt:

  1. <?php 
  2.  $fp = @fsockopen(&#092;"udp://adam\", 20100, &$errno, &$errstr); 
  3.  if (!$fp) { 
  4. echo(&#092;"<span style=\"font-weight: bold;\">Server status: <span style='color:red'>Offline</span></span>\"); 
  5.  } else { 
  6. echo(&#092;"<span style=\"font-weight: bold;\">Server status: <span style='color:green'>Online</span></span>\"); 
  7. fclose ($fp); 
  8.  } 
  9. ?>


i chcialbym sprawdzic np. czy na porcie 20100 stoji serwer gry, ale jest problem bo ten skrypt sprawdza caly czas port 80 mimo to ze ustawilem port 20100 no chyba ze w tym miejscu nie podaje sie portu tylko np. jakies opuznienie ile skrypt ma czekac na polaczenie... hmm kto pomoze rozwiazc ten problem ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
adamshl
post
Post #2





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 3.01.2005

Ostrzeżenie: (0%)
-----


Znalazlem inny fajny skrypcik ale jest maly problem bo on wyswietla satus serwera graficznie a mi wystarczy status tekstowy, probowalem juz na kilka sposobow go przerobbic ale mi cos nie wychodzi.

  1. <?php
  2. //Location of the live or dead server images
  3.  
  4. //Please change to your server specifications
  5. $live = &#092;"online.PNG\";
  6. $dead = &#092;"offline.PNG\";
  7.  
  8. //The status checking script
  9. //meddle at your own risk!
  10. //check for port number, default is 80
  11. $link = $_GET['link'].&#092;":\";
  12. $s_link = str_replace(&#092;"::\", \":\", $link);
  13. list($addr,$port)= explode (':',&#092;"$s_link\");
  14. if (empty($port)){
  15.     $port = 80;
  16. }
  17. //Test the server connection
  18. $churl = @fsockopen(server($addr), $port, $errno, $errstr, 15);
  19.              if (!$churl){
  20.              //echo $errstr;
  21.                 header(&#092;"Location: $dead\");
  22.                 }
  23.              else {
  24.                    header(&#092;"Location: $live\");             
  25.           }
  26. function server($addr){
  27.          if(strstr($addr,&#092;"/\")){$addr = substr($addr, 0, strpos($addr, \"/\"));}
  28.          return $addr;
  29. }
  30. ?>


Sprobowal by ktos przerobic ten skrypt tak aby wyswietlal status tekstowy np. Online, Offline ?

do skryptu odwoluje sie za pomoca linku. tenskrypt.php?link=o2.pl

Ten post edytował adamshl 11.01.2005, 19:15:34
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 2.10.2025 - 16:54