<?php
require_once( "inc/session.php" );

$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "22201";
$server_addr[0][2] = "KT-IDC";

$tot = count($server_addr);
 //echo "total server :".$tot."<br>";
for($i=0; $i < $tot; $i++){
	$fp = @fsockopen("udp://{$server_addr[$i][0]}", $server_addr[$i][1], $errno, $errstr);

	if (!$fp) {
		echo "ERROR: $errno - $errstr<br>\n";
        continue;
	}
	else {
		fwrite($fp,"REQUEST_SERV_UPDATE", 19);
		while(1) {
			$test2 = fread($fp, 1024);
			$test .= trim($test2);
			$j = strlen($test2);
			if($j < 64) break;
		}
		fclose($fp);
	}	
}
if ($test == "SUCCESS_0222")
{
	$msg = "서버 리스트 업데이트가 성공적으로 완료 되었습니다.";
	$font_size = "3";
	$font_color = "blue";
}
else
{
	$msg = "업데이트가 실패 했습니다";
	$font_size = "6";
	$font_color = "red";
}
?>
<html>
<head>
<meta charset="euc-kr">
<script language="javascript">
function go_main_page()
{
	opener.window.location.reload();
	self.close();
}
</script>
</head>
<body>
<table width="390" align="center">
<tr>
<td>
<font size='<?=$font_size?>' color='<?=$font_color?>'><?=$msg?></font>
</td>
</tr>
<tr align="center"> 
<td>
<input name="confirm" type="button" value="확인" onclick="javascript:go_main_page();">
</td>
</tr>
</table>
</body>
</html>
