컴퓨터/php
PvPGN 서버 온/오프 표시기
영칠이
2009. 3. 29. 14:49
<?
// PvPGN server status shower based on socket TCP connection
// Copyright ⓒ RA software. http://rasoft.hostrator.com
// Distributed under GPLv2 License.
// get ip addr from domain. replace gethostbyname() if addr is not domain
$address = gethostbyname('bnetd.net');
// socket connection starts. To show errormsg, remove @.
$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$con = @socket_connect($socket, $address, "6112");
// print off if connection aborted
if(!$con)
echo "<font color='red'>SERVER OFF</font>";
// print on if connected
else
echo "<font color='green'>SERVER ON</font>";
// close socket connection
@socket_close($socket);
?>