09. februar 2002 - 18:14
Der er
2 kommentarer og
1 løsning
fsockopen, UDP & CS Server
Hejsa. jeg har sat og rodet lidt med fsockopen for at forsøge at pinge en CS server men lige meget hav jeg laver viser den altid Online...nogen der har en stump kode der virker? :)
/DarkSide
18. februar 2002 - 12:27
#3
Prøv denne script den kan vise alt Web, Ftp, CS, FS, også vidre....
--- snip start---------¨
<?php
$domain = "ditdomain.dk";
# Enter your domain name here
######################################################################
# End of main configuration
######################################################################
function lookup($hport,$Something,$who){
$fp = fsockopen($who, $hport, &$errno, &$errstr, 4);
if (!$fp){
$data = "<tr><td width=\"50%\"><font face=\"Times New Roman\" color=\"#000000\"><strong>$Something :</td></strong></font><td width=\"60%\"><font color=\"#FF0000\"><strong>Down</strong></font></td></tr>";
} else {
$data = "<tr><td width=\"50%\"><font face=\"Times New Roman\" color=\"#000000\"><strong>$Something :</strong></td></font><td width=\"60%\"><strong><font color=\"#008000\">Running</font> </strong></font></td></tr>";
fclose($fp);
}
return $data;
}
if(isset($domain)){
echo "<h2>Server Status</h2>";
echo "<table border=\"0\" cellpadding=\"0\" width=\"100%\">";
echo "<tr><td width=\"50%\"><font face=\"Times New Roman\" color=\"#000000\"><strong>Hostname :</strong></td></font><td width=\"60%\"><strong>$domain</font> </strong></font></td></tr>";
######################################################################
# Edit you port configuration here
# Add or remove as many port numbers as you like, most of the ports
# are standard, but edit the list as you like."
#
# Format;
#
# echo lookup("portno","Port Description","$domain");
#
######################################################################
echo lookup("80","Web1","$domain");
echo lookup("21","FTP Server","$domain");
echo lookup("3306","MySQL","$domain");
echo lookup("110","POP3 Mail Server","$domain");
echo lookup("25","SMTP Relay","$domain");
echo lookup("29700","Counter Strike","$domain");
######################################################################
# End of port configuration
######################################################################
echo "</table>";
}
else {
echo "<p><strong>Error</strong><br><small>Unable to check domain</small></p>";
}
?>
--- snip slut ----
Mvh.
asdl