This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
@@ -0,0 +1,86 @@
<html>
<head>
<title></title>
<script language='javascript'>
function addGroup()
{
location.href = './add_group.html';
}
</script>
<head>
<body>
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
$objConn = new DB_Sql;
$enCoding = "set client_encoding = 'uhc'";
$objConn->query($enCoding);
$row = 0;
$table = 0;
$strSql = "SELECT a.group_seq, a.group_name, b.member_name, b.member_cellphone ";
$strSql .= "FROM t_group a ";
$strSql .= "LEFT OUTER JOIN t_group_member b ON a.group_seq = b.group_seq ";
$strSql .= "WHERE a.deleted_yn = 'N' ";
$strSql .= "ORDER BY a.group_seq, b.member_name ";
$objConn->query($strSql);
if($objConn->nf() != 0)
{
$chkFirst = 0;
while($objConn->next_record())
{
if($chkFirst == 0) $pre_group_seq = $objConn->f("group_seq");
$group_seq = $objConn->f("group_seq");
if($pre_group_seq != $group_seq)
{
$table++;
$row = 0;
}
$tmpArr[$table][$row][0] = $group_seq;
$tmpArr[$table][$row][1] = $objConn->f("group_name");
$tmpArr[$table][$row][2] = $objConn->f("member_name");
$tmpArr[$table][$row][3] = $objConn->f("member_cellphone");
//echo $table."-".$row."<br>";
//echo $pre_group_seq."-".$group_seq."<br>";
$pre_group_seq = $group_seq;
$row++;
$chkFirst++;
}
echo "<table width='230' border='0'>\n";
echo " <tr>\n";
echo " <td colspan='".($table+1)."'>\n";
echo " <a href='javascript:addGroup();'>그룹추가</a>\n";
echo " </td>\n";
echo " </tr>\n";
for($i=0; $i<($table+1); $i++)
{
if(($i+1)%3 == 0) echo " <tr align='center'>\n";
echo " <td valign='top' height='250'>\n";
echo " <table border='0' width='200'>\n";
echo " <tr>\n";
echo " <td align='center'><b>그룹명#".($i+1)." ".$tmpArr[$i][0][1]."</b></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <table border='1' width='200'>\n";
for($j=0; $j<sizeof($tmpArr[$i]); $j++)
{
echo " <tr>\n";
echo " <td width='10' align='center'>".($j+1)."</td>\n";
echo " <td width='80' align='center'><a href='./mod_member.html?group=".$tmpArr[$i][0][0]."&cell=".$tmpArr[$i][$j][3]."'>".$tmpArr[$i][$j][2]."</a></td>\n";
echo " <td width='110'>&nbsp;".$tmpArr[$i][$j][3]."</td>\n";
echo " </tr>\n";
}
echo " </table>\n";
echo "<div align='right'><a href='./add_member.html?group=".$tmpArr[$i][0][0]."'>멤버추가</a></div>";
echo " </td>\n";
if(($i+1)%3 == 0) echo " </tr>\n";
}
echo "</table>";
}
?>
</body>
</html>
@@ -0,0 +1,51 @@
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();"><img src="img/bt_contact.gif" border="0"><a>
</td>
<td align="right" class="PR40"><img src="img/Dot.gif"><a href="inc/logout_process.html"><img src="img/BtnLogout.gif" border="0" width="36" height="9"></a></td>
</tr>
</table>
<?php
$monitor_member = array( "±èÀçÇÏ"=>"010-9613-2113",
"ÃÖ½ÂÈ£"=>"010-6262-1227"
);
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
@@ -0,0 +1,55 @@
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();"><img src="img/bt_contact.gif" border="0"><a>
</td>
<td align="right" class="PR40"><img src="img/Dot.gif"><a href="inc/logout_process.html"><img src="img/BtnLogout.gif" border="0" width="36" height="9"></a></td>
</tr>
</table>
<?php
$monitor_member = array("(KT)김영식"=>"010-7311-4452",
"(KT)모민규"=>"010-2833-0015",
"(운영팀)박순성 실장"=>"010-7334-8250",
"(운영팀)성석봉 팀장"=>"010-7390-5333",
"(운영팀)정기욱"=>"011-9496-4373",
"(운영팀)김병국"=>"011-9622-3603",
"(운영팀)최현선"=>"010-5365-0370",
"(운영팀)이영재"=>"011-9733-1231");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
@@ -0,0 +1,56 @@
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();"><img src="img/bt_contact.gif" border="0"><a>
</td>
<td align="right" class="PR40"><img src="img/Dot.gif"><a href="inc/logout_process.html"><img src="img/BtnLogout.gif" border="0" width="36" height="9"></a></td>
</tr>
</table>
<?php
$monitor_member = array("(KT)김민영"=>"010-7331-5066",
"(KT)이현준"=>"010-9837-5010",
"(운영팀)박순성 실장"=>"010-7334-8250",
"(운영팀)성석봉 팀장"=>"010-7390-5333",
"(운영팀)정기욱"=>"011-9496-4373",
"(운영팀)이영재"=>"011-9733-1231",
"(운영팀)사준석"=>"017-227-5913",
"(운영팀)김훈겸"=>"016-9790-8818",
"(운영팀)박정훈"=>"010-8589-7477");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
@@ -0,0 +1,54 @@
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();"><img src="img/bt_contact.gif" border="0"><a>
</td>
<td align="right" class="PR40"><img src="img/Dot.gif"><a href="inc/logout_process.html"><img src="img/BtnLogout.gif" border="0" width="36" height="9"></a></td>
</tr>
</table>
$monitor_member = array("(KT)김영식"=>"010-7311-4452",
"(KT)모민규"=>"010-2833-0015",
"(운영팀)박순성 실장"=>"010-7334-8250",
"(운영팀)성석봉 팀장"=>"010-7390-5333",
"(운영팀)정기욱"=>"011-9496-4373",
"(운영팀)김병국"=>"011-9622-3603",
"(운영팀)최현선"=>"010-5365-0370",
"(운영팀)이영재"=>"011-9733-1231");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
@@ -0,0 +1,78 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
$id = $_GET['id'];
$msg = $_GET['msg'];
$id = "ALL";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '$id' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
$dbConnMySql = new dbconnect('222.122.18.22', 'smsuser', 'sms5emffld)', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
}
}
}
?>
@@ -0,0 +1,51 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
$id = $_GET['id'];
$msg = $_GET['msg'];
$id = "ALL";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '$id' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$dbConnMySql = new dbconnect('211.39.134.240', 'ktsh', 'ktsh!@#', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$tmpSqlmy = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 ) ";
//$tmpSqlmy .= "VALUES ( '$cellphone', '', sysdate(), '$msg', 'ktsh')";
$tmpSqlmy .= "VALUES ( '$cellphone', '$cellphone', sysdate(), '$msg', 'ktsh')";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
}
}
?>
@@ -0,0 +1,55 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$msg = $_GET['msg'];
if($id != "" && $pw != "" && $msg != "")
{
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//$strSqlpg .= "LIMIT 1 ";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$dbConnMySql = new dbconnect('211.39.134.109', 'sh_trans', 'sh_trans', 'midc', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$tmpSqlmy = "INSERT INTO sms(id, dstaddr, msg, deliver) ";
$tmpSqlmy .= "VALUES ('SH_".$id."', '".$cellphone."', '".$msg."', 9)";
echo "$tmpSqlmy";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,7 @@
AuthUserFile /user/service/wwwroot/htpasswd/.htpasswd
AuthGroupFile /dev/null
AuthName "KT ADMIN"
AuthType Basic
<Limit GET>
require valid-user
</Limit>
@@ -0,0 +1,377 @@
<html>
<head>
<title>######## SYSTEM-HOSTING SERVICE STATUS ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
</head>
<body onLoad="UpdateClocks()">
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<?php
$monitor_member = array("OP ROOM"=>"031-781-0399",
"강명균"=>"016-574-5625",
"최현선(주중야간)"=>"011-365-0370",
"박성우(주중야간)"=>"011-9953-7630",
"김기백(주중주간)"=>"017-608-2385",
"김동민(주말야간)"=>"011-9719-8899",
"김경완"=>"011-9279-1325, 010-2800-1325",
"박정제"=>"011-9737-1955, 02-805-1955",
"강중권"=>"011-745-4849, 02-868-6378",
"임상현"=>"019-376-1236, 010-3337-1236",
"박상용"=>"011-9776-8839",
"배상범"=>"010-4613-8795, 010-4631-8795");
?>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## SYSTEM-HOSTING SERVICE STATUS ########</h3></td>
</tr>
</table>
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30002";
$server_addr[0][2] = "DREAMLINE-1";
/*
$server_addr[1][0] = "127.0.0.1";
$server_addr[1][1] = "30001";
$server_addr[1][2] = "DREAMLINE-2";
*/
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 1024);
$test .= trim($test2);
$j = strlen($test2);
//echo $test2;
if($j < 1024) break;
}
fclose($fp);
}
//echo $test;
$pt = new parsePipe();
$result = $pt->parseIt($test);
$tot_tr = $pt->countIt();
//echo $tot_tr
?>
<td valign=top><table border=1 cellpadding=1 cellspacing=0>
<tr height="35">
<td colspan="9">
<center><b>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status Changed At</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Disk Checked At</font></b></center></td>
<td width="170"><center><b><font color="#000066">Domain</font></b></center></td>
<td width="70"><center><b><font color="#000066">Total Disk</font></b></center></td>
<td width="70"><center><b><font color="#000066">Free</font></b></center></td>
<td width="70"><center><b><font color="#000066">Used</font></b></center></td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
$totalDisk += $result[$j][8];
$freeDisk += $result[$j][9];
$usedDisk += ($result[$j][8] - $result[$j][9]);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $result[$j][5])?></td>
<td align="center">
<?
if ($result[$j][6] == "-") {
echo "-";
} else {
echo date("Y-m-d H:i:s", $result[$j][6]);
}
?></td>
<td align="center"><?=$pt->translateIt($result[$j][7],7)?></td>
<td align="center"><?=$pt->translateIt($result[$j][8],8)?></td>
<td align="center" bgcolor="<?=$pt->translateIt($result[$j][10],100)?>"><?=$pt->translateIt(trim($result[$j][9]), 8)?></td>
<td align="center">
<?
if($result[$j][8] == "-") echo "-";
else echo $pt->translateIt($result[$j][8]-$result[$j][9], 9);
?>
</td>
</tr>
</span>
<?
}
?>
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
</tr>
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
<form action=<?=$PHP_SELF?> method=POST>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr);
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'UISSD', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
}
?>
@@ -0,0 +1,11 @@
<?
$mode = "EVENT:INFO:ONE";
$command = 'bin/raidmond_client 127.0.0.1 8787 "'.$mode.'"';
#222.122.136.11 8787 "EVENT:INFO:ONE"
#$command = 'bin/raidmond_client 222.122.136.11 8787 "'.$mode.'"';
//echo $command;
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
print_r($raid_str);
?>
@@ -0,0 +1,176 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
if(getenv("REQUEST_METHOD") != "POST")
{
?>
<html>
<head>
<title></title>
<script language='javascript'>
function chkForm()
{
frm = document.info;
if(frm.group_id.value == '')
{
alert('그룹아이디를 입력하세요!');
return;
}
if(frm.group_name.value == '')
{
alert('그룹명을 입력하세요!');
return;
}
if(frm.group_password.value == '' || frm.group_password_confirm.value == '')
{
alert('비밀번호를 입력하세요!');
return;
}
if(frm.group_name.value != frm.group_password_confirm.value)
{
alert('비밀번호를 확인 하십시오!');
return;
}
frm.submit();
}
</script>
</head>
<body>
<form name='info' method='POST' action='./add_group.html'>
<table>
<tr>
<td>&nbsp;그룹ID</td>
<td><input name='group_id' maxlength='20'></td>
</tr>
<tr>
<td>&nbsp;그룹명</td>
<td><input name='group_name' maxlength='20'></td>
</tr>
<tr>
<td>&nbsp;패스워드</td>
<td><input type="password" name='group_password' maxlength='20'></td>
</tr>
<tr>
<td>&nbsp;패스워드확인</td>
<td><input type="password" name='group_password_confirm' maxlength='20'></td>
</tr>
<tr>
<td colspan='2'>
<div align='right'><a href='javascript:history.back(-1)'>뒤로</a>&nbsp;<a href='javascript:chkForm();'>추가</a></div>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
}else if(getenv("REQUEST_METHOD") == "POST")
{
$group_id = trim($_POST['group_id']);
$group_name = trim($_POST['group_name']);
$group_password = trim($_POST['group_password']);
$group_password_confirm = trim($_POST['group_password_confirm']);
if($group_id != "" && $group_name != "" && ($group_password == $group_password_confirm))
{
$objConn = new DB_Sql;
$enCoding = "set client_encoding = 'uhc'";
$objConn->query($enCoding);
$strSql = "SELECT COUNT(group_seq) AS cnt ";
$strSql .= "FROM t_group ";
$strSql .= "WHERE group_id = '".$group_id."' AND deleted_yn = 'N' ";
$objConn->query($strSql);
if($objConn->nf() != 0)
{
$objConn->next_record();
$cnt = $objConn->f("cnt");
if($cnt == 0)
{
$strSql = "INSERT INTO t_group(group_id, group_password, group_name, deleted_yn, ";
$strSql .= " reg_datetime, update_datetime) ";
$strSql .= "VALUES ('".$group_id."', '".$group_password."', '".$group_name."', 'N', now(), now())";
$objConn->query($strSql);
echo "<script language='javascript'>\n";
echo " alert('등록되었습니다.');\n";
echo " location.href = './group_list.html';\n";
echo "</script>";
}else
{
echo "<script language='javascript'>\n";
echo " alert('그룹이 존재합니다.');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
}else
{
echo "<script language='javascript'>\n";
echo " alert('잘못된 접근입니다.');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
}else
{
echo "<script language='javascript'>\n";
echo " alert('잘못된 접근입니다.');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
}
die;
/*
$group_seq = trim($_POST['group']);
$member_name = trim($_POST['member_name']);
$member_cellphone = trim(str_replace("-", "", $_POST['member_cellphone']));
$strSql = "SELECT COUNT(group_seq) AS cnt ";
$strSql .= "FROM t_group_member ";
$strSql .= "WHERE group_seq = ".$group_seq." AND member_cellphone = '".$member_cellphone."'";
$objConn->query($strSql);
if($objConn->nf() != 0)
{
$objConn->next_record();
$cnt = $objConn->f("cnt");
if($cnt == 0)
{
$strSql = "INSERT INTO t_group_member(group_seq, member_name, member_cellphone, reg_datetime, update_datetime) ";
$strSql .= "VALUES (".$group_seq.", '".$member_name."', '".$member_cellphone."', now(), now())";
$objConn->query($strSql);
echo "<script language='javascript'>\n";
echo " alert('등록되었습니다.');\n";
echo " location.href = './group_list.html';\n";
echo "</script>";
}else
{
echo "<script language='javascript'>\n";
echo " alert('이미 등록되었습니다.');\n";
echo " history.back(-1);\n";
echo "</script>";
}
}
}
}else
{
echo "<script language='javascript'>\n";
echo " alert('잘못된 접근입니다..');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
*/
?>
@@ -0,0 +1,101 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
$group_seq = isset($_GET['group']) ? $_GET['group'] : $_POST['group'];
if($group_seq != "")
{
$objConn = new DB_Sql;
$enCoding = "set client_encoding = 'uhc'";
$objConn->query($enCoding);
if(getenv("REQUEST_METHOD") == "GET")
{
?>
<html>
<head>
<title></title>
<script language='javascript'>
function chkForm()
{
frm = document.info;
if(frm.member_name.value == '')
{
alert('이름을 입력하세요!');
return;
}
if(frm.member_cellphone.value == "")
{
alert('핸드폰번호를 입력하세요!');
return;
}
frm.submit();
}
</script>
</head>
<body>
<form name='info' method='POST' action='./add_member.html'>
<table>
<tr>
<td>&nbsp;이름</td>
<td><input name='member_name' maxlength='20'></td>
</tr>
<tr>
<td>&nbsp;핸드폰</td>
<td><input name='member_cellphone' maxlength='15'></td>
</tr>
<tr>
<td colspan='2'>
<input type='hidden' name='group' value='<?= $group_seq ?>'>
<div align='right'><a href='javascript:history.back(-1)'>뒤로</a>&nbsp;<a href='javascript:chkForm();'>추가</a></div>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
}else if(getenv("REQUEST_METHOD") == "POST")
{
$group_seq = trim($_POST['group']);
$member_name = trim($_POST['member_name']);
$member_cellphone = trim(str_replace("-", "", $_POST['member_cellphone']));
$strSql = "SELECT COUNT(group_seq) AS cnt ";
$strSql .= "FROM t_group_member ";
$strSql .= "WHERE group_seq = ".$group_seq." AND member_cellphone = '".$member_cellphone."'";
$objConn->query($strSql);
if($objConn->nf() != 0)
{
$objConn->next_record();
$cnt = $objConn->f("cnt");
if($cnt == 0)
{
$strSql = "INSERT INTO t_group_member(group_seq, member_name, member_cellphone, reg_datetime, update_datetime) ";
$strSql .= "VALUES (".$group_seq.", '".$member_name."', '".$member_cellphone."', now(), now())";
$objConn->query($strSql);
echo "<script language='javascript'>\n";
echo " alert('등록되었습니다.');\n";
echo " location.href = './group_list.html';\n";
echo "</script>";
}else
{
echo "<script language='javascript'>\n";
echo " alert('이미 등록되었습니다.');\n";
echo " history.back(-1);\n";
echo "</script>";
}
}
}
}else
{
echo "<script language='javascript'>\n";
echo " alert('잘못된 접근입니다..');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
?>
@@ -0,0 +1,306 @@
<?php
// kt : mysql / lgu : oracle
// example)
// LGU : http://211.233.68.197:8080/alert/send_alert.php?order=lgu&type=dblb&sendhost=nh01-mdslb02.x-cdn.com&smsgroup=TEST&mailgroup=trozan@solbox.com&time=20111012092823&msg=shutdown-host:nh01-mds02.x-cdn.com
// KT : http://sh-raid.solbox.com/alert/send_alert.php?order=kt&type=dblb&sendhost=bd04-mdslb01.x-cdn.com&smsgroup=TEST&mailgroup=trozan@solbox.com&time=20111012141300&msg=asdfasdfasasfasd
$order = strtoupper($_GET['order']); // kt|lgu
$type = strtoupper($_GET['type']); // raid|dblb
$sendhost = $_GET['sendhost']; // host
$smsgroup = $_GET['smsgroup']; // test|all etc...
$mailgroup = $_GET['mailgroup']; // scv1@solbox.com;scv2@solbox.com;op@solbox....
$time = $_GET['time']; // time
$message = $_GET['msg']; // msg
$trace = $_GET['trace']; // print ment ('true' is detail log)
$from_mail = "storage.sd@solbox.com";
define(ORDER_TYPE, $order);
require_once ("../inc/pgsql.inc");
require_once ("../inc/sendmail.inc");
if($order == "KT")
{
define(DB_HOST , "222.122.18.22");
define(DB_USER , "smsuser");
define(DB_PWD , "sms5emffld)");
define(PGDB_HOST, "127.0.0.1");
require_once ("../inc/mysql.inc");
}
else if($order == "LGU")
{
define(DB_HOST , "xcdnuser");
define(DB_USER , "solbox123");
define(DB_SID , "SMS");
define(PGDB_HOST, "61.111.52.4");
require_once ("../inc/oci8inc.php");
}
else
{
echo "Order not found";
exit;
}
function TRACE($msg, $trace)
{
if($trace == "true")
echo $msg;
}
function cutstr($str, $size)
{
if(!$size or (strlen($str) <= $size))
return $str;
else
for($i = 0;$i < $size;$i++)
{
if(ord($str[$i]) > 127)
$over++;
}
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg, $dbConnPgSql, $strSqlpg, $group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count = 0;
$cellphone_list = "";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
TRACE("fail to pgsql querty : $strSqlpg <br><br>", $trace);
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$smsgroup."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
TRACE("fail to send SMS<br><br>", $trace);
return false;
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg, $dbConnPgSql, $strSqlpg, $group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count = 0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
TRACE("fail to pgsql querty : $strSqlpg <br><br>", $trace);
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect(DB_HOST, DB_USER, DB_SID);
if( !$dbConnOra->conn )
TRACE("Oracle Connect Failed<br><br>", $trace);
TRACE("Oracle DB SERVER Connecting...<br><br>", $trace);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
TRACE("fail to send SMS<br><br>", $trace);
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf())
{
TRACE("Success to All send SMS<br><br>", $trace);
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$raddr = $_SERVER["REMOTE_ADDR"];
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$message;
if($time != "")
{
$time = sprintf("%s-%s %s:%s:%s"
, substr($time, 4, 2)
, substr($time, 6, 2)
, substr($time, 8, 2)
, substr($time, 10, 2)
, substr($time, 12, 2)
);
}
$msg = "[".$type.":".$sendhost."] ".$time." ".$message;
TRACE("1. MAIL : " . $msg . "<br>", $trace);
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $sendhost";
system("$cmd >> logs/".$type.".send.sms.mail.`date +%Y%m%d`.log");
if($type != "RAID")
$body = $msg;
else
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
if($mailgroup != "")
{
$to_mail = explode(";", $mailgroup);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
if(ereg("(^[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*$)", $to_mail[$i]))
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
}
}
if($smsgroup != "" && $msg != "")
{
$sms_host = strtok( $sendhost, "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $message;
if( strncmp( $message, "Controller#", 11) == 0 )
{
$sms_msg = substr( $message, 10 );
}
// $msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[".$type.":".$sms_host."] ".$sms_time." ".$sms_msg;
$dbConnPgSql = new DB_Sql;
$dbConnPgSql->setHostIP(PGDB_HOST);
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$smsgroup."' AND deleted_yn = 'N'";
$nLength=strlen($msg);
TRACE("2. SMS : $msg (size :$nLength)\n<br><br>", $trace);
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($nLength > 80)
{
$strtmp = $msg;
$msg = cutstr($strtmp,80);
$nLength = strlen($msg);
TRACE("CutSTR Message : $msg Size :$nLength \n<br><br>", $trace);
}
$bSendSMS = false;
for($i = 0; $i< 2; $i++)
{
if(!$bSendSMS)
{
if( ORDER_TYPE == "KT" )
$bSendSMS = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $smsgroup );
else if( ORDER_TYPE == "LGU")
$bSendSMS = sendsms_oracle( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $smsgroup );
if( $bSendSMS ) break;
}
}
if(!$bSendSMS)
{
TRACE("Unexpected error was occured<br><br>", $trace);
}
}
else
TRACE("PGSQL `group_seq` failed<br><br>", $trace);
$dbConnPgSql->close();
echo "success";
}
else // end if($dbConnPgSql->nf() == 1)
TRACE("smsgroup or msg NULL!!!<br><br>", $trace);
}
else
TRACE("Unexpected error was occured. id : \"$smsgroup\" msg :\"$msg\"\n<br><br>", $trace);
exit;
?>
@@ -0,0 +1,292 @@
// Removes leading and trailing spaces from the passed string. Also removes
// consecutive spaces and replaces it with one space. If something besides
// a string is passed in (null, custom object, etc.) then return the input.
function trimString(inputString) {
if (typeof inputString != "string") {
return inputString;
}
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == " ") {
// Check for spaces at the beginning of the string
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == " ") { // Check for spaces at the end of the string
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf(" ") != -1) {
// Note that there are two spaces in the string - look for multiple spaces within the string
retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+ 1, retValue.length); // Again, there are two spaces in each of the strings
}
return retValue; // Return the trimmed string back to the user
}
// Ends the "trim" function
function idnKeyboard(url)
{
myPopupWin= window.open(url,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=818,height=350');
myPopupWin.focus();
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+args[i+2]+args[i+3]+args[i+4]+"'");
}
function submitRequest(url)
{
self.opener.location.href=url;
self.opener.document.submit();
}
function setGainingRegIDValue(selectedform, selectedRegID ) {
selectedRegID.value = selectedform.regID.options[selectedform.regID.selectedIndex].value;
}
function PopWin(myUrl, arg1, arg2, arg3, width, height,resizable)
{
var url=myUrl+arg1+arg2+arg3;
myPopupWin = window.open(url,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=700', copyhistory=0);
myPopupWin.focus();
}
function appendValues(nameObj)
{
if (isEmpty(nameObj.value) ) return;
appendOptionToSelectBox(window.document.form1.userNameList,
nameObj.value, false);
}
function appendNVPair(nameObj, valueObj)
{
if (isEmpty(nameObj.value) ) return;
if (isEmpty(valueObj.value) ) return;
str = nameObj.value + "=" + valueObj.value;
appendOptionToSelectBox(window.document.form1.userNameList, str, false);
}
function appendContPairs(nameObj, valueObj)
{
if (isEmpty(nameObj.value) ) return;
if (isEmpty(valueObj.value) ) return;
str = nameObj.value + "=" + valueObj.value;
appendOptionToSelectBox(window.document.form1.regContList, str, false);
}
function appendIPAdressValue(nameObj, valueObj)
{
if (isEmpty(nameObj.value) ) return;
if (isEmpty(valueObj.value) ) return;
str = nameObj.value + "=" + valueObj.value;
appendOptionToSelectBox(window.document.form1.nsIplist, str, false);
}
function removeNVPair()
{
if(window.document.form1.userNameList.selectedIndex >=0 ){
//removeOptionSelected(window.document.form1.userValueList);
removeOptionSelected(window.document.form1.userNameList);
}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function validateIP(theIP,theField, formCxt)
{
if( !isValidIPV4(theIP) ) {
formCxt.setError();
alert('invalid entry: '+formCxt.getFieldDescription(theField.name));
}
}
function setRegIDValue(selectedRegID ) {
selectedRegID.value = window.document.query.regID.options[window.document.query.regID.selectedIndex].value;
}
var timerID ;
function tzone(tz, os, ds, cl)
{
this.ct = new Date(0) ; // datetime
this.tz = tz ; // code
this.os = os ; // GMT offset
this.ds = ds ; // has daylight savings
this.cl = cl ; // font color
}
function UpdateClocks()
{
// www.timeanddate.com/worldclock
var ct = new Array(
new tzone('UTC: ', 0, 1, '#FFAA00'),
new tzone('KST: ', +9, 1, '#FFAA00'),
new tzone('EST: ', -5, 1, '#FFAA00'),
new tzone('GMT: ', 0, 1, '#FFAA00'),
new tzone('C N : ', +8, 0, 'silver'),
new tzone('KST: ', +9, 0, 'silver'),
new tzone('EDT: ', -4, 1, 'silver'),
new tzone('GER: ', +1, 1, 'silver')
) ;
var dt = new Date() ; // [GMT] time according to machine clock
var startDST = new Date(dt.getFullYear(), 3, 1) ;
while (startDST.getDay() != 0)
startDST.setDate(startDST.getDate() + 1) ;
var endDST = new Date(dt.getFullYear(), 9, 31) ;
while (endDST.getDay() != 0)
endDST.setDate(endDST.getDate() - 1) ;
var ds_active ; // DS currently active
if (startDST < dt && dt < endDST)
ds_active = 1 ;
else
ds_active = 0 ;
// Adjust each clock offset if that clock has DS and in DS.
for(n=0 ; n<ct.length ; n++)
if (ct[n].ds == 1 && ds_active == 1) ct[n].os++ ;
// compensate time zones
gmdt = new Date() ;
for (n=0 ; n<ct.length ; n++)
ct[n].ct = new Date(gmdt.getTime() + ct[n].os * 3600 * 1000) ;
window.document.getElementById("Clock0").innerHTML = '<font color="' + ct[0].cl + '">' + ct[0].tz + ClockString(ct[0].ct) + '</font>' ;
window.document.getElementById("Clock1").innerHTML = '<font color="' + ct[1].cl + '">' + ct[1].tz + ClockString(ct[1].ct) + '</font>' ;
window.document.getElementById("Clock2").innerHTML = '<font color="' + ct[2].cl + '">' + ct[2].tz + ClockString(ct[2].ct) + '</font>' ;
window.document.getElementById("Clock3").innerHTML = '<font color="' + ct[3].cl + '">' + ct[3].tz + ClockString(ct[3].ct) + '</font>' ;
window.document.getElementById("Clock4").innerHTML = '<font color="' + ct[4].cl + '">' + ct[4].tz + ClockString(ct[4].ct) + '</font>' ;
window.document.getElementById("Clock5").innerHTML = '<font color="' + ct[5].cl + '">' + ct[5].tz + ClockString(ct[5].ct) + '</font>' ;
window.document.getElementById("Clock6").innerHTML = '<font color="' + ct[6].cl + '">' + ct[6].tz + ClockString(ct[6].ct) + '</font>' ;
window.document.getElementById("Clock7").innerHTML = '<font color="' + ct[7].cl + '">' + ct[7].tz + ClockString(ct[7].ct) + '</font>' ;
timerID = window.setTimeout("UpdateClocks()", 1001) ;
}
function ClockString(dt)
{
var stemp, ampm ;
var dt_year = dt.getUTCFullYear() ;
var dt_month = dt.getUTCMonth() + 1 ;
var dt_day = dt.getUTCDate() ;
var dt_hour = dt.getUTCHours() ;
var dt_minute = dt.getUTCMinutes() ;
var dt_second = dt.getUTCSeconds() ;
dt_year = dt_year.toString() ;
if (0 <= dt_hour && dt_hour < 12)
{
ampm = 'AM' ;
// if (dt_hour == 0) dt_hour = 12 ;
} else {
ampm = 'PM' ;
// dt_hour = dt_hour - 12 ;
// if (dt_hour == 0) dt_hour = 12 ;
}
if (dt_hour < 10)
dt_hour = '0' + dt_hour ;
if (dt_minute < 10)
dt_minute = '0' + dt_minute ;
if (dt_second < 10)
dt_second = '0' + dt_second ;
//stemp = dt_month + '/' + dt_day + '/' + dt_year.substr(2,2) ;
stemp = dt_year + '/' + dt_month + '/' + dt_day;
stemp = stemp + ' ' + dt_hour + ":" + dt_minute + ":" + dt_second + ' ' + ampm ;
return stemp ;
}
function goToURL( myUrl, arg1, arg2, arg3 ) {
window.location.href=myUrl+arg1+arg2+arg3;
}
function validateStreet(value, theField, formCxt)
{
if(value.length >= 10) {
formCxt.setError();
alert('invalid entry: '+formCxt.getFieldDescription(theField.name));
}
}
function validateName(value,theField, formCxt )
{
if(value.length > 5) {
formCxt.setError();
alert('invalid entry: '+formCxt.getFieldDescription(theField.name));
}
}
function validateEmail(email, theField, formCxt)
{
if ( ! isValidEmail(email) ){
formCxt.setError();
alert('invalid entry: '+formCxt.getFieldDescription(theField.name));
}
}
function selectNVPair(nameObj, valueObj, nvplistObj)
{
nm = nameObj;
val = valueObj;
ix = nvplistObj.selectedIndex;
if(ix < 0 ) return;
nm.value = userNVPList.getName(ix);
val.value = userNVPList.getValue(ix);
val.focus();
}
//Name server add and delete functions
function addNS(nslistObj,nsObj)
{
appendOptionToSelectBox(nslistObj,nsObj);
}
function removeNS(nslistObj,nsObj)
{
removeOptionFromSelectBox(nslistObj,nsObj);
}
function selectNS(nslistObj,nsObj)
{
selectOption(nslistObj,nsObj);
}
function selectAll(list1, list2, list3)
{
if (list1)
selectList(list1);
if (list2)
selectList(list2);
if (list3)
selectList(list3);
}
@@ -0,0 +1,109 @@
H1 A:link, H2 A:link, H3 A:link, H4 A:link, H5 A:link, H6 A:link,
H1 A:visited, H2 A:visited, H3 A:visited, H4 A:visited, H5 A:visited, H6 A:visited
{color: #000;}
.ratBodyText
{ font-family: arial, helvetica, sans-serif; }
.ratBodyText
{ font-size: 12px; }
A:link
{ color: #000000; }
A:visited
{ color: #000000; }
A:link:hover
{color: #900;}
A:visited:hover
{color: #600;}
.ratBodyText
{ color: #000000; }
BODY {
background-color: #ffffff;
color: #000;
margin: 0px 0px;
}
.ratNav {
background-color: #036;
color: #fff;
}
.ratNav A:link, .ratNav A:visited { color: #fff; }
.ratNavHighlight A:link, .ratNavHighlight A:visited { color: #fff; }
.ratNavHighlight {
background-color: #c00;
color: #fff;
}
TD{
font-family: Arial,Vernada, Helvetica, sans-serif;
}
.ratNavText {
font-family: µ¸¿òü, Arial, Helvetica, sans-serif;
font-size: 12px;
;font-weight: bold;
line-height: 120%;
padding-left: 0px;
; text-decoration: none
; text-indent: 15pt
}
@@ -0,0 +1,160 @@
TIME_OUT_READ=5
HEALTH_CHECK_TERM=5
REPORT_THREAD_PORT=30001
DATABASE_NAME=syshost
DATABASE_ADDR=211.38.137.35
DATABASE_ACCT=syshost
DATABASE_PW=alfkzmf!?{}
DATABASE_PORT=5432
SERV=0UDISK_RTS001:222.122.136.11:80:RTS
SERV=0UDISK_RTS002:222.122.136.12:80:RTS
SERV=0UDISK_RTS003:222.122.136.13:80:RTS
SERV=0UDISK_RTS004:222.122.136.14:80:RTS
SERV=0UDISK_RTS005:222.122.136.15:80:RTS
SERV=0UDISK_RTS006:222.122.136.16:80:RTS
SERV=0UDISK_RTS007:222.122.136.17:80:RTS
SERV=0UDISK_RTS008:222.122.136.18:80:RTS
SERV=0UDISK_RTS009:222.122.136.19:80:RTS
SERV=0UDISK_RTS010:222.122.136.20:80:RTS
SERV=0UDISK_RTS011:222.122.136.21:80:RTS
SERV=0UDISK_RTS012:222.122.136.22:80:RTS
SERV=0UDISK_RTS013:222.122.136.23:80:RTS
SERV=0UDISK_RTS014:222.122.136.24:80:RTS
SERV=0UDISK_RTS015:222.122.136.31:80:RTS
SERV=0UDISK_RTS016:222.122.136.32:80:RTS
SERV=0UDISK_RTS017:222.122.136.33:80:RTS
SERV=0UDISK_RTS018:222.122.136.34:80:RTS
SERV=0UDISK_RTS019:222.122.136.35:80:RTS
SERV=0UDISK_RTS020:222.122.136.36:80:RTS
SERV=0UDISK_RTS021:222.122.136.37:80:RTS
SERV=0UDISK_RTS022:222.122.136.38:80:RTS
SERV=0UDISK_RTS023:222.122.136.39:80:RTS
SERV=0UDISK_RTS024:222.122.136.40:80:RTS
SERV=0UDISK_RTS025:222.122.136.41:80:RTS
SERV=0UDISK_RTS026:222.122.136.42:80:RTS
SERV=0UDISK_RTS027:222.122.136.43:80:RTS
SERV=0UDISK_RTS028:222.122.136.44:80:RTS
SERV=0UDISK_RTS029:222.122.136.45:80:RTS
SERV=0UDISK_RTS030:222.122.136.46:80:RTS
SERV=0UDISK_RTS031:222.122.136.47:80:RTS
SERV=0UDISK_RTS032:222.122.136.48:80:RTS
SERV=0UDISK_RTS033:222.122.136.49:80:RTS
SERV=0UDISK_RTS034:222.122.136.50:80:RTS
SERV=0UDISK_RTS035:222.122.136.51:80:RTS
SERV=0UDISK_RTS036:222.122.136.52:80:RTS
SERV=0UDISK_RTS037:222.122.136.53:80:RTS
SERV=0UDISK_RTS038:222.122.136.54:80:RTS
SERV=0UDISK_RTS039:222.122.136.55:80:RTS
SERV=0UDISK_RTS040:222.122.136.56:80:RTS
SERV=0UDISK_RTS041:222.122.136.57:80:RTS
SERV=0UDISK_RTS042:222.122.136.58:80:RTS
SERV=0UDISK_RTS043:222.122.136.59:80:RTS
SERV=0UDISK_RTS044:222.122.136.60:80:RTS
SERV=0UDISK_RTS045:222.122.136.61:80:RTS
SERV=0UDISK_RTS046:222.122.136.62:80:RTS
SERV=0UDISK_RTS047:222.122.136.63:80:RTS
SERV=0UDISK_RCTS01:222.122.136.25:13104:RCTS
SERV=0UDISK_DB01:222.122.136.27:5432:RCDB
SERV=SORIBADA_RTS1001:222.122.153.11:80:RTS
SERV=SORIBADA_RTS1002:222.122.153.12:80:RTS
SERV=SORIBADA_RTS1003:222.122.153.13:80:RTS
SERV=SORIBADA_RTS1004:222.122.153.14:80:RTS
SERV=SORIBADA_RTS1005:222.122.153.15:80:RTS
SERV=SORIBADA_RTS1006:222.122.153.16:80:RTS
SERV=SORIBADA_RTS1007:222.122.153.17:80:RTS
SERV=SORIBADA_RTS1008:222.122.153.18:80:RTS
SERV=SORIBADA_RTS1009:222.122.153.19:80:RTS
SERV=SORIBADA_RTS1010:222.122.153.20:80:RTS
SERV=SORIBADA_RTS1011:222.122.153.21:80:RTS
SERV=SORIBADA_RTS1012:222.122.153.22:80:RTS
SERV=SORIBADA_RTS1013:222.122.153.23:80:RTS
SERV=SORIBADA_RTS1014:222.122.153.24:80:RTS
SERV=SORIBADA_RTS1015:222.122.153.25:80:RTS
SERV=SORIBADA_RTS1016:222.122.153.26:80:RTS
SERV=SORIBADA_RTS1017:222.122.153.27:80:RTS
SERV=SORIBADA_RTS1018:222.122.153.28:80:RTS
SERV=SORIBADA_RTS1019:222.122.153.29:80:RTS
SERV=SORIBADA_RTS1020:222.122.153.30:80:RTS
SERV=SORIBADA_RTS1021:222.122.153.31:80:RTS
SERV=SORIBADA_RTS1022:222.122.153.32:80:RTS
SERV=SORIBADA_RTS1023:222.122.153.33:80:RTS
SERV=SORIBADA_RTS1024:222.122.153.34:80:RTS
SERV=SORIBADA_RTS1025:222.122.153.35:80:RTS
SERV=SORIBADA_RTS1026:222.122.153.36:80:RTS
SERV=SORIBADA_RTS1027:222.122.153.37:80:RTS
SERV=SORIBADA_RTS1028:222.122.153.38:80:RTS
SERV=SORIBADA_RTS1029:222.122.153.39:80:RTS
SERV=SORIBADA_RTS1030:222.122.153.40:80:RTS
SERV=SORIBADA_RTS1031:222.122.153.41:80:RTS
SERV=SORIBADA_RTS1032:222.122.153.42:80:RTS
SERV=SORIBADA_RTS1033:222.122.153.43:80:RTS
SERV=SORIBADA_RTS1034:222.122.153.44:80:RTS
SERV=SORIBADA_RTS1035:222.122.153.45:80:RTS
SERV=SORIBADA_RTS1036:222.122.153.46:80:RTS
SERV=SORIBADA_RTS1037:222.122.153.47:80:RTS
SERV=SORIBADA_RTS1038:222.122.153.48:80:RTS
SERV=SORIBADA_RTS1039:222.122.153.49:80:RTS
SERV=SORIBADA_RTS1040:222.122.153.50:80:RTS
SERV=SORIBADA_RTS1041:222.122.153.51:80:RTS
SERV=SORIBADA_RTS1042:222.122.153.52:80:RTS
SERV=SORIBADA_RTS1043:222.122.153.53:80:RTS
SERV=SORIBADA_RTS1044:222.122.153.54:80:RTS
SERV=SORIBADA_RTS1045:222.122.153.55:80:RTS
SERV=SORIBADA_RTS1046:222.122.153.56:80:RTS
SERV=SORIBADA_RTS1047:222.122.153.57:80:RTS
SERV=SORIBADA_RTS1048:222.122.153.58:80:RTS
SERV=SORIBADA_RTS1049:222.122.153.59:80:RTS
SERV=SORIBADA_RTS1050:222.122.153.60:80:RTS
SERV=SORIBADA_RTS1051:222.122.153.61:80:RTS
SERV=SORIBADA_RTS1052:222.122.153.62:80:RTS
SERV=SORIBADA_RTS1053:222.122.153.63:80:RTS
SERV=SORIBADA_RTS1054:222.122.153.64:80:RTS
SERV=SORIBADA_RTS1055:222.122.153.65:80:RTS
SERV=SORIBADA_RTS1056:222.122.153.66:80:RTS
SERV=SORIBADA_RTS1057:222.122.153.67:80:RTS
SERV=SORIBADA_RTS1058:222.122.153.68:80:RTS
SERV=SORIBADA_RTS1059:222.122.153.69:80:RTS
SERV=SORIBADA_RTS1060:222.122.153.70:80:RTS
SERV=SORIBADA_RTS1061:222.122.153.71:80:RTS
SERV=SORIBADA_RTS1062:222.122.153.72:80:RTS
SERV=SORIBADA_RTS1063:222.122.153.73:80:RTS
SERV=SORIBADA_RTS1064:222.122.153.74:80:RTS
SERV=SORIBADA_RTS1065:222.122.153.75:80:RTS
SERV=SORIBADA_RTS1066:222.122.153.76:80:RTS
SERV=SORIBADA_RTS1067:222.122.153.77:80:RTS
SERV=SORIBADA_RTS1068:222.122.153.78:80:RTS
SERV=SORIBADA_RTS1069:222.122.153.79:80:RTS
SERV=SORIBADA_RTS1070:222.122.153.80:80:RTS
SERV=SORIBADA_RTS1071:222.122.153.81:80:RTS
SERV=SORIBADA_RTS1072:222.122.153.82:80:RTS
SERV=SORIBADA_RTS1073:222.122.153.83:80:RTS
SERV=SORIBADA_RTS1074:222.122.153.84:80:RTS
SERV=SORIBADA_RTS1075:222.122.153.85:80:RTS
SERV=SORIBADA_RTS1076:222.122.153.86:80:RTS
SERV=SORIBADA_RTS1077:222.122.153.87:80:RTS
SERV=SORIBADA_RTS1078:222.122.153.88:80:RTS
SERV=SORIBADA_RTS1079:222.122.153.89:80:RTS
SERV=SORIBADA_RTS1080:222.122.153.90:80:RTS
SERV=SORIBADA_RTS1081:222.122.153.91:80:RTS
SERV=SORIBADA_RTS1082:222.122.153.92:80:RTS
SERV=SORIBADA_RTS1083:222.122.153.93:80:RTS
SERV=SORIBADA_RTS1084:222.122.153.94:80:RTS
SERV=SORIBADA_RTS1085:222.122.153.95:80:RTS
SERV=SORIBADA_RTS1086:222.122.153.96:80:RTS
SERV=SORIBADA_RTS1087:222.122.153.97:80:RTS
SERV=SORIBADA_RTS1088:222.122.153.98:80:RTS
SERV=SORIBADA_RTS1089:222.122.153.99:80:RTS
SERV=SORIBADA_RTS1090:222.122.153.100:80:RTS
SERV=SORIBADA_RTS1091:222.122.153.101:80:RTS
SERV=SORIBADA_RTS1092:222.122.153.102:80:RTS
SERV=SORIBADA_RTS1093:222.122.153.103:80:RTS
SERV=SORIBADA_RTS1094:222.122.153.104:80:RTS
SERV=SORIBADA_RTS1095:222.122.153.105:80:RTS
SERV=SORIBADA_RTS1096:222.122.153.106:80:RTS
SERV=SORIBADA_RTS1097:222.122.153.107:80:RTS
SERV=SORIBADA_RCTS03:222.122.153.8:13104:RCTS
SERV=SORIBADA_RCTS04:222.122.153.9:13104:RCTS
#SERV=SORIBADA_DB01:222.122.153.2:5432:RCDB
#SERV=SORIBADA_DB02:222.122.153.3:5432:RCDB
SERV=SORIBADA_DB03:222.122.153.4:5432:RCDB
SERV=SORIBADA_PGLB01:222.122.152.15:6543:RCDB
@@ -0,0 +1,64 @@
<?php
declare(ticks=1);
echo "I'm going to be a Dad.\n";
if (spawn_child('child_function')) {
echo 'Parent pid:'.posix_getpid()."\n";
}
echo "I'm going to be a Dad again!.\n";
if (spawn_child('child_function',1,2,3,4)) {
echo 'Child - 2 Parent pid:'.posix_getpid()."\n";
}
echo "What you're pregnant again!?.\n";
if (spawn_child('grand_children')) {
echo 'Child - 3 Parent pid:'.posix_getpid()."\n";
}
function grand_children() {
echo "Dad I'm going to have a baby.\n";
spawn_child('child_function','Joe');
echo "I'm so proud of my kids.\n";
}
function spawn_child($function) {
$original_pid = posix_getpid();
$pid = pcntl_fork();
if ($pid == -1) {
die ("Unable to spawn child\n");
}
$new_pid = posix_getpid();
if ($new_pid == $original_pid) {
return true;
}
if (function_exists($function)) {
$numargs = func_num_args();
if ($numargs > 1) {
$args = func_get_args();
//print_r ($args);
unset($args[0]);
call_user_func($function,$args);
} else {
call_user_func($function);
}
echo "Done with child ".$new_pid." they moved out.\n";
exit;
} else {
die ("$function does not exist\n");
}
}
function child_function() {
echo 'Child pid:'.posix_getpid()."\n";
$args = func_get_args();
if (!empty($args))
print_r ($args);
}
pcntl_wait( $status);
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

@@ -0,0 +1,373 @@
<?
// 문서루트 경로
$DOC_ROOT = "http://".$_SERVER['SERVER_ADDR']."/status";
// 라이브러리 경로
$LIB_PATH = "/user2/service/opendisk_lib";
// 외부호출할 실행파일 경로
$BIN_PATH = "/user2/service/bin";
$VOLUME_MANAGER_FIME_NAME = "service_manager";
$BACKUP_MANAGER_FILE_NAME = "db_process";
// 삭제한 볼륨로그를 저장할 경로
$VOLUME_REMOVE_LOG_PATH = "/user2/service/httpd/htdocs/sms/log";
// RRD 데이터베이스를 write하고 이미지를 생성해 놓을 경로.
$RRD_WRITE_PATH = "/user/service/opendisk_rrd";
$RRD_IMG_WRITE_PATH = "/user/httpd/htdocs/sms/rrdimg";
// RRD공유라이브러리를 명시적으로 로딩할 것인가 아닌가 플래그
$RRD_LOAD_SO = 1;
// 쿠키 암호화 여부 플래그
$COOKIE_CRYPT_ENABLE = 0;
// 디비백업파일이 존재하는 경로
$BACKUP_FILE_PATH = "/user2/service/db_download";
// html 페이지 타이틀
$HTML_PAGE_TITLE = "OpenDisk Cluster Administration";
// 코드 (관리자레벨)
$CODE_ADMIN_TYPE = array();
$CODE_ADMIN_TYPE[0][0] = "AT01";
$CODE_ADMIN_TYPE[0][1] = "전체관리자";
$CODE_ADMIN_TYPE[1][0] = "AT02";
$CODE_ADMIN_TYPE[1][1] = "일반관리자";
// 코드 (이벤트)
$CODE_EVENT_TYPE = array();
$CODE_EVENT_TYPE[0][0] = "EV01";
$CODE_EVENT_TYPE[0][1] = "관리작업";
$CODE_EVENT_TYPE[1][0] = "EV02";
$CODE_EVENT_TYPE[1][1] = "시스템장애";
$CODE_EVENT_TYPE[2][0] = "EV03";
$CODE_EVENT_TYPE[2][1] = "용량경고";
$CODE_EVENT_TYPE[3][0] = "RAID";
$CODE_EVENT_TYPE[3][1] = "RAID 이벤트 ";
/**
* 볼륨관련 커맨드를 실행한다.
*
* @param ManageType 769:볼륨추가, 770:볼륨변경, 771:볼륨삭제
* @param VolumeSeq 추가할 볼륨의 데이터베이스테이블시퀀스
*
* @return "1" 동작 성공시
* @return "some reason" 동작 실패시 원인
*/
function ManageVolume( $ManageType, $VolumeSeq )
{
global $BIN_PATH;
global $VOLUME_MANAGER_FIME_NAME;
$CMD = $BIN_PATH . "/" . $VOLUME_MANAGER_FIME_NAME . " " . "$ManageType" . " " . "$VolumeSeq";
//echo $CMD;exit;
if( !$FileHandle = popen("$CMD", "r") )
{
return "error: process fork failed";
}
while( !feof($FileHandle) )
{
$output .= fgets( $FileHandle, 1024 );
}
pclose( $FileHandle );
// 커맨드를 실행하여 성공이면 1을 반환하고 그외에는 모두 실패로 간주한다.
if( $output == "SUCCESS\n" )
{
return 1;
}
else
{
return $output;
}
}
/**
* 백업관련 커맨드를 실행한다.
*
* @param ManageType 'backup':볼륨별개별백업, 'backupall':전체볼륨백업
* @param DBIP 백업할 DB서버의 IP
* @param Port 백업할 DB서버의 PORT
* @param VolumeSeq 개별볼륨백업일때 그 볼륨의 시퀀스
*
* @return "1" 동작 성공시
* @return "some reason" 동작 실패시 원인
*/
function ManageBackup( $ManageType, $DBIP, $Port, $VolumeSeq, $VolumName)
{
global $BIN_PATH;
global $BACKUP_MANAGER_FILE_NAME;
$CMD = $BIN_PATH . "/" . $BACKUP_MANAGER_FILE_NAME . " " . "$ManageType" . " " . "$DBIP" . " " . "$Port" . " " ."$VolumeSeq". " " .$VolumName;
//echo $CMD; exit;
if( !$FileHandle = popen("$CMD", "r") )
{
return "error: process fork failed";
}
while( !feof($FileHandle) )
{
$output .= fgets( $FileHandle, 1024 );
}
pclose( $FileHandle );
// 커맨드를 실행하여 성공이면 1을 반환하고 그외에는 모두 실패로 간주한다.
if( $output == "SUCCESS\n" )
{
return 1;
}
else
{
return $output;
}
}
/**
* 용량단위변환 : 메가바이트 -> 기가바이트 단위로 변환 (1024 M = 1G)
*/
function StorageUnit_GB( $value )
{
return sprintf("%.2fGB", trim($value) / 1024);
}
/**
* 용량단위변환 : 메가바이트 -> 기가/테라바이트 단위로 변환
*/
function StorageUnit( $value )
{
if( trim($value) / 1024 > 1024 )
return sprintf("%.2fTB", trim($value) / 1024 / 1024);
else
return sprintf("%.2fGB", trim($value) / 1024);
}
/**
* 트래픽단위변환 : 바이트 -> 메가바이트 단위로 변환
*/
function TrafficUnit( $value )
{
return sprintf("%.2f", trim($value) / 1000 / 1000);
}
/**
* html 헤더태그를 생성
*
* @param ScriptPath 스크립트가 있을 경우 그 파일명
*/
function PrintHtmlHeader( $ScriptPath )
{
global $DOC_ROOT;
global $HTML_PAGE_TITLE;
echo "<head>";
echo "<title>$HTML_PAGE_TITLE</title>";
echo "<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=euc-kr\">";
echo "<link href=\"$DOC_ROOT/css/style.css\" rel=\"stylesheet\" type=\"text/css\">";
if( $ScriptPath != "" )
echo "<script language=\"javascript\" type=\"text/javascript\" src=\"$ScriptPath\"></script>";
echo "<style>BODY,TABLE,TR,TD {font-size:12px;}select{behavior: url('".$DOC_ROOT."/css/selectbox.htc');}TD{line-height:150%;}</style>";
echo "</head>";
}
/**
* 코드값을 저장하는 셀렉트박스 태그를 생성
*
* @param arrCode 코드값을 저장한 배열명
* @param selectedvalue selected 옵션을 삽입할 value값
*/
function PrintCodeSelectOption( $arrCode, $selectedvalue )
{
for( $i = 0; $i < sizeof($arrCode); $i++ )
{
if( $arrCode[$i][0] == $selectedvalue )
echo "<option value='" . $arrCode[$i][0] . "' selected>" . $arrCode[$i][1];
else
echo "<option value='" . $arrCode[$i][0] . "'>" . $arrCode[$i][1];
}
}
/**
* 셀렉트박스 태그를 생성
*
* @param type YYYY/MM/DD 중의 하나
* @param name 셀렉트태그의 이름속성
* @param start 시작할 값
* @param end 끝 값
* @param selectedvalue 어떤 값을 선택상태로 할 것인가 지정
*/
function PrintSelectbox( $type, $name, $start, $end, $selectedvalue )
{
switch( $type )
{
case "YYYY":
echo "<select name='$name' style='width:60; height=19'>";
for( $i = $start; $i < ($end + 1); $i++ )
{
if( $i == $selectedvalue )
echo "<option value='$i' selected>$i";
else
echo "<option value='$i'>$i";
}
echo "</select>&nbsp;년&nbsp;";
break;
case "MM":
echo "<select name='$name' style='width:45; height=19'>";
for( $i = $start; $i < ($end + 1); $i++ )
{
if( $i == $selectedvalue )
echo "<option value='$i' selected>$i";
else
echo "<option value='$i'>$i";
}
echo "</select>&nbsp;월&nbsp;";
break;
case "DD":
echo "<select name='$name' style='width:45; height=19'>";
for( $i = $start; $i < ($end + 1); $i++ )
{
if( $i == $selectedvalue )
echo "<option value='$i' selected>$i";
else
echo "<option value='$i'>$i";
}
echo "</select>&nbsp;일&nbsp;";
break;
}
}
/**
* 메시지박스를 호출
*/
function AlertMsg( $msg )
{
$msg = str_replace ("\n", "\\r", $msg);
echo("<script language=\"javascript\">
<!--
alert('$msg');
//-->
</script>
");
}
/**
* 메시지박스를 보여주고 이전페이지로 이동
*/
function AlertBack( $msg )
{
$msg = str_replace ("\n", "\\r", $msg);
echo("<script language=\"javascript\">
<!--
alert('$msg');
history.back();
//-->
</script>
");
}
/**
* 쿠키값을 체크하여 정상적으로 로그인한 사용자인지 확인한 후 관리자레벨을 반환한다.
* @return AdminLevel 1: 전체관리자레벨 2: 일반관리자레벨
*/
require_once( "crypt.inc" ); // 암호화 인터페이스
function CheckCookie()
{
global $DOC_ROOT;
global $CODE_ADMIN_TYPE;
if( isset($_COOKIE["cookie_admin_id"]) )
{
$CookieSEED = "skldfhoi40wyrf83yf0hs9efh8943yf9herf";
$crypt = new cast128;
$crypt->setkey( $CookieSEED );
if($COOKIE_CRYPT_ENABLE == 1){
$dec_admin_id = $crypt->decrypt( base64_decode( $_COOKIE["cookie_admin_id"] ) );
$dec_admin_name = $crypt->decrypt( base64_decode( $_COOKIE["cookie_admin_name"] ) );
$dec_admin_type = $crypt->decrypt( base64_decode( $_COOKIE["cookie_admin_type"] ) );
$dec_admin_email = $crypt->decrypt( base64_decode( $_COOKIE["cookie_admin_email"] ) );
$dec_admin_phone = $crypt->decrypt( base64_decode( $_COOKIE["cookie_admin_phone"] ) );
$dec_admin_sms_send = $crypt->decrypt( base64_decode( $_COOKIE["cookie_admin_sms_send"] ) );
}else{
$dec_admin_id = $_COOKIE["cookie_admin_id"] ;
$dec_admin_name = $_COOKIE["cookie_admin_name"] ;
$dec_admin_type = $_COOKIE["cookie_admin_type"] ;
$dec_admin_email = $_COOKIE["cookie_admin_email"] ;
$dec_admin_phone = $_COOKIE["cookie_admin_phone"] ;
$dec_admin_sms_send = $_COOKIE["cookie_admin_sms_send"] ;
}
if( $dec_admin_type == $CODE_ADMIN_TYPE[0][0] )
return 1;
else if( $dec_admin_type == $CODE_ADMIN_TYPE[1][0] )
return 2;
}
else
{
foreach ($_REQUEST as $req_key => $req_val){
if (!is_array ($_REQUEST[$req_key]))
{
if($req_key!='id'&&$req_key!='password'&&$req_key!='admintype')
$get_str .= "$req_key=$req_val&";
}
}
/***
echo nl2br(print_r($_SERVER,true));exit;
if($get_str!='')
$get_str .= "HTTP_REFERER=".urlencode($_SERVER['HTTP_REFERER']);
echo $_SERVER['HTTP_REFERER'];exit;
****/
echo( "<META http-equiv='refresh' content='0; url=$DOC_ROOT/login/login.html?src_uri=".urlencode($_SERVER['REQUEST_URI'])."'>" );
exit;
}
}
/**
* 좌측메뉴를 구성하는 테이블을 생성한다.
*
* @param Title 좌측메뉴의 타이틀
* @param submenu_exist 타이틀 아래에 서브메뉴를 추가할 것인가 아닌가
* @param arr_submenu 추가할 서브메뉴의 텍스트를 저장한 배열
* @param arr_submenulink 추가할 서브메뉴의 링크를 저장한 배열
* @param SelectedIndex 서브메뉴들 중에 어느 것을 선택하게 할 것인가 그 배열인덱스
*/
function PrintLeftMenu( $Title, $submenu_exist, $arr_submenu, $arr_submenulink, $SelectedIndex )
{
?>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr height=12>
<td></td>
</tr>
<tr height=1>
<td bgcolor="#B9B9B9"></td>
</tr>
<!-- menu title -->
<tr height=30>
<td align=center class="LeftMenuTitle">
<?echo("$Title")?>
</td>
</tr>
<tr height=1>
<td bgcolor="#B9B9B9"></td>
</tr>
<!-- submenu -->
<?
if( $submenu_exist == 1 )
{
for( $i = 0; $i < count($arr_submenu); $i++ )
{
if( $i == $SelectedIndex )
echo("<tr height=30><td align=center class=LeftMenu bgcolor=#CDCDCD><a href='$arr_submenulink[$i]'>$arr_submenu[$i]</a></td></tr>");
else
echo("<tr height=30><td align=center class=LeftMenu><a href='$arr_submenulink[$i]'>$arr_submenu[$i]</a></td></tr>");
}
}
?>
</table>
<?
}
?>
@@ -0,0 +1,777 @@
<?php
// +----------------------------------------------------------------------+
// | Perfect Scripts class.pcrypt.php |
// | Brazilian Organization |
// +----------------------------------------------------------------------+
// | Viva ao Linux! |
// | Porque nós amamos a liberdade! |
// +----------------------------------------------------------------------+
// | Class Perfect Crypt |
// | Created By Igor Ribeiro de Assis |
// | <igor21@terra.com.br> UIN: 71064682 |
// +----------------------------------------------------------------------+
// | http://ps.wmforce.com |
// +----------------------------------------------------------------------+
// | Under GPL |
// +----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published |
// | by the Free Software Foundation; either version 2 of the License, |
// | or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
// | 02111-1307 USA |
// +----------------------------------------------------------------------+
/**
* Encryption Block Mode constants
*
* @const MODE_ECB ecb mode
* @const MODE_CBC cbc mode
*/
define("MODE_ECB",0);
define("MODE_CBC",1);
/**
* An abstract layer class to encrypt data.
*
* This class is class is used to encrypt and decrypt data using different algorithms
* and modes.
*
* @author Igor Ribeiro de Assis <igor21@terra.com.br>
* @version 1.0-beta
* @access public
* @package Perfect Crypt
*/
class cast128
{
/** Encryption Block Mode: ECB, CBC actually.
*
* @var int the mode used
* @access private
*/
var $blockmode = MODE_CBC;
/** Key for Encryption
*
* @var string the key used in encryption and decryption
* @access public
*/
var $key = null;
/** IV - Initialization Vector String
*
* @var string initialization vector for some modes (CBC)
* @access public
*/
//var $iv = "z4c8e7gh";
//var $iv = "z4c8e7gh";
var $iv = null;// = "tsetsetstset";
//var $iv = "Sts2Fj1E";
/** Methods */
/** Constructor of the class.
*
* The constructor initialize some important vars and include the algorithm
* file.
*
* @access public
* @param int $blockmode the blockmode to use
* @param string $cipher the algorithm used to crypt
* @param string $key the ley used to crypt
*
* @return void
*/
function setkey($key)
{
if(!empty($key)) {
$this->pcrypt(MODE_CBC, 'BLOWFISH', $key);
}
}
function pcrypt($blockmode = MODE_CBC, $cipher = 'BLOWFISH', $key)
{
// Include cipher_class file
$blockmode = MODE_CBC;
$cipher = 'BLOWFISH';
$cipher = strtolower($cipher);
if (!class_exists("pcrypt_".$cipher))
{
$this->error("Class pcrypt_".$cipher." doesn't exists");
}
$class = "pcrypt_".$cipher;
$this->cipher = new $class($key);
// Initialize Vars
$this->blockmode = $blockmode;
$this->key = $key;
}
/** Crypt data using the selected algorithm
*
* This method encrypt data using the selected algorithm and mode:
* Algorithms: Blowfish
* Modes: ECB, CBC
* For a description about algorithms and modes see:
* Applied Cryptography by Bruce Schneier
*
* @access public
* @param string $plain the plain text to be encrypted
* @return string $cipher the plain text encrypted
*/
function encrypt($plain)
{
if (empty($plain))
{
$this->error("Empty Plain Text");
}
// Encrypt using the correct mode
$this->iv = $plain;
switch($this->blockmode) {
case MODE_ECB:
$cipher = $this->_ecb_encrypt($plain);
break;
case MODE_CBC:
$cipher = $this->_cbc_encrypt($plain);
break;
default:
$this->error("Invalid mode ".$this->blockmode);
}
return $cipher;
}
/** Decrypt using the selected algorithm
*
* This method decrypt data using the selected algorithm and mode.
* TODO: Discover the algorithm and mode auto
*
* @access public
* @param string $cipher the crypted data to be decrypted
* @return string $plain the cipher text decrypted
*/
function decrypt($cipher)
{
if (empty($cipher))
{
$this->error("Invalid Cipher Text");
}
// Decrypt with the correct mode
switch($this->blockmode) {
case MODE_ECB:
$plain = $this->_ecb_decrypt($cipher);
break;
case MODE_CBC:
$plain = $this->_cbc_decrypt($cipher);
break;
default:
$this->error("Invalid mode ".$this->blockmode);
}
return $plain;
}
/** Method to encrypt using ECB mode.
*
* In ECB mode the blocks are encrypted independently
*
* @access private
* @param string $plain the plain text to be encrypted
* @return string $cipher the plain text encrypted
*/
function _ecb_encrypt($plain)
{
$blocksize = $this->cipher->blocksize;
$plainsize = strlen($plain);
$cipher = '';
for($i = 0;$i < $plainsize;$i = $i + $blocksize)
{
$block = substr($plain,$i,$blocksize);
if(strlen($block) < $blocksize)
{
// pad block with '\0'
$block = str_pad($block,$blocksize,"\0",STR_PAD_LEFT);
}
$cipher .= $this->cipher->_encrypt($block);
}
return $cipher;
}
/** Method to decrypt using ECB mode.
*
* @access private
* @param string $cipher the cipher text
* @return string $plain the cipher text decrypted
*/
function _ecb_decrypt($cipher)
{
$blocksize = $this->cipher->blocksize;
$ciphersize = strlen($cipher);
$plain = '';
for($i = 0;$i < $ciphersize;$i = $i + $blocksize)
{
$block = substr($cipher,$i,$blocksize);
$block = $this->cipher->_decrypt($block);
// Remove padded chars
while(substr($block,0,1) == "\0")
{
$block = substr($block,1);
}
$plain .= $block;
}
return $plain;
}
/** This method encrypt using CBC mode.
*
* In CBC mode each block is xored with the last. This function use $iv as
* first block.
*
* @access private
* @param string $plain the plain text to be decrypted
* @return string $cipher the plain text encrypted
*/
function _cbc_encrypt($plain)
{
$blocksize = $this->cipher->blocksize;
$plainsize = strlen($plain);
$cipher = '';
$lcipher = $this->iv;
// encrypt each block
for($i = 0;$i < $plainsize;$i = $i + $blocksize)
{
$block = substr($plain,$i,$blocksize);
if(strlen($block) < $blocksize)
{
// pad block with '\0'
$block = str_pad($block,$blocksize,"\0",STR_PAD_LEFT);
}
// crypt the block xored with the last cipher block
$lcipher = $this->cipher->_encrypt($block ^ $lcipher);
$cipher .= $lcipher;
}
return $cipher;
}
/** This method decrypt using CBC.
*
* @access private
* @param string $cipher the cipher text
* @return string $plain the cipher text decrypted
*/
function _cbc_decrypt($cipher)
{
// get the block size of the cipher
$blocksize = $this->cipher->blocksize;
$ciphersize = strlen($cipher);
$plain = '';
$lcipher = $this->iv;
for($i = 0;$i < $ciphersize;$i = $i + $blocksize)
{
$block = substr($cipher,$i,$blocksize);
// xor the block with the last cipher block
$dblock = $lcipher ^ $this->cipher->_decrypt($block);
$lcipher = $block;
// Remove padded chars
while(substr($dblock,0,1) == "\0")
{
$dblock = substr($dblock,1);
}
$plain .= $dblock;
}
return $plain;
}
/**
* A simple function for error handling.
*
* TODO: Improve the error handling of the class
*
* @access private
* @param string $message erro message
* @return boolean true
*/
function error($message)
{
echo "Error: ".$message."<br>";
return 1;
}
}
// +----------------------------------------------------------------------+
// | Perfect Scripts blowfish.php |
// | Brazilian Organization |
// +----------------------------------------------------------------------+
// | Viva ao Linux! |
// | Porque nós amamos a liberdade! |
// +----------------------------------------------------------------------+
// | Class Perfect Crypt |
// | Created By Igor Ribeiro de Assis |
// | <igor21@terra.com.br> UIN: 71064682 |
// +----------------------------------------------------------------------+
// | http://ps.wmforce.com |
// +----------------------------------------------------------------------+
// | Under GPL |
// +----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published |
// | by the Free Software Foundation; either version 2 of the License, |
// | or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
// | 02111-1307 USA |
// +----------------------------------------------------------------------+
// | Mon Apr 12 17:01:55 BRT 2004 |
// +----------------------------------------------------------------------+
/**
* Class Blowfish extends PCrypt Class
* This class is a implementation of the Blowfish Crypt Algorithm to use with
* PCrypt Class.
* Based on Bruce Schneier Code in Applied Cryptography Book
*/
class pcrypt_blowfish
{
/** Attributes */
/**
* S-Boxes ($sbox0, $sbox1, $sbox2 and $sbox3)
*
* These are the subkeys boxes with 256 entries each.
*
* @access private
* @var array
*/
var $sbox0 = array (
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658,
0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e,
0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6,
0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c,
0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1,
0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a,
0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176,
0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706,
0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b,
0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c,
0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a,
0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760,
0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8,
0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33,
0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0,
0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777,
0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705,
0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e,
0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9,
0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f,
0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a);
var $sbox1 = array(
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d,
0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65,
0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9,
0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d,
0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc,
0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908,
0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124,
0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908,
0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b,
0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa,
0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d,
0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5,
0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96,
0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca,
0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77,
0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054,
0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea,
0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646,
0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea,
0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e,
0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd,
0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7);
var $sbox2 = array(
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7,
0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af,
0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4,
0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec,
0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332,
0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58,
0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22,
0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60,
0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99,
0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74,
0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3,
0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979,
0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa,
0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086,
0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24,
0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84,
0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09,
0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe,
0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0,
0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188,
0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8,
0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0);
var $sbox3 = array(
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742,
0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79,
0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a,
0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1,
0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797,
0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6,
0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba,
0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5,
0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce,
0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd,
0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb,
0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc,
0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc,
0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a,
0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a,
0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b,
0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e,
0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623,
0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a,
0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3,
0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c,
0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6);
/** P-Array consists of 18 32-bit subkeys
*
* @var array $parray
* @access private
*/
var $parray = array(
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0,
0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b);
/** Block size in bytes
*
* @access public
* @var int $blocksize
*/
var $blocksize = 8; //bytes
/** Methods */
/** The Constructor of the class.
*
* This class make a copy of the $sboxs and $parray and init the subkeys.
*
* @access public
* @param string $key the key used to encrypt and decrypt
* @return void
*/
function pcrypt_blowfish($key)
{
$this->bctx = array('p' => $this->parray,
'sb' => array( $this->sbox0, $this->sbox1,
$this->sbox2, $this->sbox3));
$this->_init($key);
}
/** This functions encrypt the block.
*
* @access private
* @param int $Xl left uInt32 part of the block
* @param int $Xr right uInt32 part of the block
* @return void
*/
function _blowfish_crypt(&$Xl, &$Xr)
{
for($i = 0; $i < 16; $i++)
{
$Xl = $Xl ^ $this->bctx['p'][$i];
$Xr = $this->_F($Xl) ^ $Xr;
// Swap $Xl and $Xr
$tmp = $Xl;
$Xl = $Xr;
$Xr = $tmp;
}
// Undo last swap
$tmp = $Xl;
$Xl = $Xr;
$Xr = $tmp;
$Xr = $Xr ^ $this->bctx['p'][16];
$Xl = $Xl ^ $this->bctx['p'][17];
}
/** This method decrypt the block.
*
* @access private
* @param int $Xl left uInt32 part of the block
* @param int $Xr right uInt32 part of the block
* @return void
*/
function _blowfish_decrypt(&$Xl, &$Xr)
{
for($i = 17; $i >= 2 ; $i--)
{
$Xl = $Xl ^ $this->bctx['p'][$i];
$Xr = $this->_F($Xl) ^ $Xr;
// Swap $Xl and $Xr
$tmp = $Xl;
$Xl = $Xr;
$Xr = $tmp;
}
// Undo last swap
$tmp = $Xl;
$Xl = $Xr;
$Xr = $tmp;
$Xr = $Xr ^ $this->bctx['p'][1];
$Xl = $Xl ^ $this->bctx['p'][0];
}
/** The F function defined in Blowfish paper.
*
* Divide the block in 4 parts and execute the function
*
* @access private
* @param int $x the block
* @return int $y the new block
*/
function _F($x)
{
$d = $x & 0xff;
$x = $x >> 8;
$c = $x & 0xff;
$x = $x >> 8;
$b = $x & 0xff;
$x = $x >> 8;
$a = $x & 0xff;
$y = $this->bctx['sb'][0][$a] + $this->bctx['sb'][1][$b];
$y = ($y ^ $this->bctx['sb'][2][$c]) + $this->bctx['sb'][3][$d];
return $y;
}
/** This function initialize the subkeys.
*
* @access public
* @param string $key the key used to encrypt and decrypt
* @return void
*/
function _init($key)
{
// unpack binary string in unsigned chars
$key = array_values(unpack("C*",$key));
$keyl = count($key);
$j = 0;
for ($i = 0; $i < 18; $i++)
{
// xor P1 with the first 32-bits of the key, xor P2 with the second 32-bits ...
$data = 0;
for($k = 0; $k < 4; $k++)
{
$data = ($data << 8) | $key[$j];
$j++;
if ($j >= $keyl)
$j = 0;
}
$this->bctx['p'][$i] = $this->parray[$i] ^ $data;
}
// encrypt the zero-string, replace P1 and P2 with the encrypted data, encrypt P3 and P4 with the new P1 and P2, do it with all P-array and subkeys
$datal = 0;
$datar = 0;
for ($i = 0; $i < 18; $i += 2)
{
$this->_blowfish_crypt($datal, $datar);
$this->bctx['p'][$i] = $datal;
$this->bctx['p'][$i+1] = $datar;
}
for ($i = 0; $i < 4; $i++)
{
for ($j = 0; $j < 256; $j += 2)
{
$this->_blowfish_crypt($datal, $datar);
$this->bctx['sb'][$i][$j] = $datal;
$this->bctx['sb'][$i][$j+1] = $datar;
}
}
}
/** This method is called by pcrypt class.
*
* This method encrypt the block and return the new block.
*
* @access public
* @param string $block the block to be encrypted
* @return string the block encrypted
*/
function _encrypt($block)
{
// unpack the block in unsigned long ints (uInt32)
$data = array_values(unpack('N*', $block));
// encrypt the block and return the block packed into string
$this->_blowfish_crypt($data[0],$data[1]);
return pack('N*',$data[0], $data[1]);
}
/** This method is called by pcrypt class.
*
* This method decrypt the cipher block and return the new.
*
* @access public
* @param string $block the encrypted block to be decrypted
* @return string the plain text block
*/
function _decrypt($block)
{
// unpack the block in unsigned long ints (uInt32)
$data = array_values(unpack('N*', $block));
// decrypt the block and return the block packed into string
$this->_blowfish_decrypt($data[0],$data[1]);
return pack('N*',$data[0],$data[1]);
}
}
?>
@@ -0,0 +1,441 @@
<?php
class DB_Sql {
/* public: connection parameters */
//var $Host = "121.125.25.194";
var $Host = "127.0.0.1";
var $Database = "CCDB";
var $Port = "3306";
var $User = "root";
var $Password = "alfkzmf!?{}";
/* public: configuration parameters */
var $Auto_Free = 0; ## Set to 1 for automatic mysql_free_result()
var $Debug = 0; ## Set to 1 for debugging messages.
var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore error, but spit a warning)
var $PConnect = 0; ## Set to 1 to use persistent database connections
var $Seq_Table = "db_sequence";
/* public: result array and current row number */
var $Record = array();
var $Row;
/* public: current error number and error text */
var $Errno = 0;
var $Error = "";
/* private: link and query handles */
var $Link_ID = 0;
var $Query_ID = 0;
var $locked = false; ## set to true while we have a lock
/* public: constructor */
function DB_Sql($query = "") {
if($query) {
$this->query($query);
}
}
/* public: some trivial reporting */
function link_id() {
return $this->Link_ID;
}
function query_id() {
return $this->Query_ID;
}
/* public: connection management */
function connect($Database = "", $Host = "", $User = "", $Password = "") {
/* Handle defaults */
if ("" == $Database)
$Database = $this->Database;
if ("" == $Host)
$Host = $this->Host;
if ("" == $User)
$User = $this->User;
if ("" == $Password)
$Password = $this->Password;
/* establish connection, select database */
if ( 0 == $this->Link_ID ) {
if(!$this->PConnect) {
$this->Link_ID = @mysql_connect($Host, $User, $Password);
} else {
$this->Link_ID = @mysql_pconnect($Host, $User, $Password);
}
if (!$this->Link_ID) {
$this->connect_failed("connect ($Host, $User, \$Password) failed");
return 0;
}
if (!@mysql_select_db($Database,$this->Link_ID)) {
$this->connect_failed("cannot use database ".$Database);
return 0;
}
}
return $this->Link_ID;
}
function connect_failed($message) {
$this->Halt_On_Error = "yes";
$this->halt($message);
}
function close() {
@mysql_close($this->Link_ID);
}
/* public: discard the query result */
function free() {
@mysql_free_result($this->Query_ID);
$this->Query_ID = 0;
}
function beginTrans() {
return $this->query("start transaction");
}
function commitTrans() {
return $this->query("commit");
}
function rollbackTrans() {
return $this->query("rollback");
}
/* public: perform a query */
function query($Query_String) {
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;
if (!$this->connect()) {
return 0; /* we already complained in connect() about that. */
};
# New query, discard previous result.
if ($this->Query_ID) {
$this->free();
}
if ($this->Debug)
printf("Debug: query = %s<br>\n", $Query_String);
$this->Query_ID = @mysql_query($Query_String,$this->Link_ID);
$this->Row = 0;
$this->Errno = mysql_errno();
$this->Error = mysql_error();
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
# Will return nada if it fails. That's fine.
return $this->Query_ID;
}
/* public: walk result set */
function next_record() {
if (!$this->Query_ID) {
$this->halt("next_record called with no query pending.");
return 0;
}
$this->Record = @mysql_fetch_array($this->Query_ID);
$this->Row += 1;
$this->Errno = mysql_errno();
$this->Error = mysql_error();
$stat = is_array($this->Record);
if (!$stat && $this->Auto_Free) {
$this->free();
}
return $stat;
}
/* public: position in result set */
function seek($pos = 0) {
$status = @mysql_data_seek($this->Query_ID, $pos);
if ($status)
$this->Row = $pos;
else {
$this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
/* half assed attempt to save the day,
* but do not consider this documented or even
* desireable behaviour.
*/
@mysql_data_seek($this->Query_ID, $this->num_rows());
$this->Row = $this->num_rows();
return 0;
}
return 1;
}
/* public: table locking */
function lock($table, $mode = "write") {
$query = "lock tables ";
if(is_array($table)) {
while(list($key,$value) = each($table)) {
// text keys are "read", "read local", "write", "low priority write"
if(is_int($key)) $key = $mode;
if(strpos($value, ",")) {
$query .= str_replace(",", " $key, ", $value) . " $key, ";
} else {
$query .= "$value $key, ";
}
}
$query = substr($query, 0, -2);
} elseif(strpos($table, ",")) {
$query .= str_replace(",", " $mode, ", $table) . " $mode";
} else {
$query .= "$table $mode";
}
if(!$this->query($query)) {
$this->halt("lock() failed.");
return false;
}
$this->locked = true;
return true;
}
function unlock() {
// set before unlock to avoid potential loop
$this->locked = false;
if(!$this->query("unlock tables")) {
$this->halt("unlock() failed.");
return false;
}
return true;
}
/* public: evaluate the result (size, width) */
function affected_rows() {
return @mysql_affected_rows($this->Link_ID);
}
function num_rows() {
return @mysql_num_rows($this->Query_ID);
}
function num_fields() {
return @mysql_num_fields($this->Query_ID);
}
/* public: shorthand notation */
function nf() {
return $this->num_rows();
}
function np() {
print $this->num_rows();
}
function f($Name) {
if (isset($this->Record[$Name])) {
return $this->Record[$Name];
}
}
function p($Name) {
if (isset($this->Record[$Name])) {
print $this->Record[$Name];
}
}
/* public: sequence numbers */
function nextid($seq_name) {
/* if no current lock, lock sequence table */
if(!$this->locked) {
if($this->lock($this->Seq_Table)) {
$locked = true;
} else {
$this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
return 0;
}
}
/* get sequence number and increment */
$q = sprintf("select nextid from %s where seq_name = '%s'",
$this->Seq_Table,
$seq_name);
if(!$this->query($q)) {
$this->halt('query failed in nextid: '.$q);
return 0;
}
/* No current value, make one */
if(!$this->next_record()) {
$currentid = 0;
$q = sprintf("insert into %s values('%s', %s)",
$this->Seq_Table,
$seq_name,
$currentid);
if(!$this->query($q)) {
$this->halt('query failed in nextid: '.$q);
return 0;
}
} else {
$currentid = $this->f("nextid");
}
$nextid = $currentid + 1;
$q = sprintf("update %s set nextid = '%s' where seq_name = '%s'",
$this->Seq_Table,
$nextid,
$seq_name);
if(!$this->query($q)) {
$this->halt('query failed in nextid: '.$q);
return 0;
}
/* if nextid() locked the sequence table, unlock it */
if($locked) {
$this->unlock();
}
return $nextid;
}
/* public: return table metadata */
function metadata($table = "", $full = false) {
$count = 0;
$id = 0;
$res = array();
/*
* Due to compatibility problems with Table we changed the behavior
* of metadata();
* depending on $full, metadata returns the following values:
*
* - full is false (default):
* $result[]:
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
*
* - full is true
* $result[]:
* ["num_fields"] number of metadata records
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
* This last one could be used if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*/
// if no $table specified, assume that we are working with a query
// result
if ($table) {
$this->connect();
$id = @mysql_list_fields($this->Database, $table);
if (!$id) {
$this->halt("Metadata query failed.");
return false;
}
} else {
$id = $this->Query_ID;
if (!$id) {
$this->halt("No query specified.");
return false;
}
}
$count = @mysql_num_fields($id);
// made this IF due to performance (one if is faster than $count if's)
if (!$full) {
for ($i=0; $i<$count; $i++) {
$res[$i]["table"] = @mysql_field_table ($id, $i);
$res[$i]["name"] = @mysql_field_name ($id, $i);
$res[$i]["type"] = @mysql_field_type ($id, $i);
$res[$i]["len"] = @mysql_field_len ($id, $i);
$res[$i]["flags"] = @mysql_field_flags ($id, $i);
}
} else { // full
$res["num_fields"]= $count;
for ($i=0; $i<$count; $i++) {
$res[$i]["table"] = @mysql_field_table ($id, $i);
$res[$i]["name"] = @mysql_field_name ($id, $i);
$res[$i]["type"] = @mysql_field_type ($id, $i);
$res[$i]["len"] = @mysql_field_len ($id, $i);
$res[$i]["flags"] = @mysql_field_flags ($id, $i);
$res["meta"][$res[$i]["name"]] = $i;
}
}
// free the result only if we were called on a table
if ($table) {
@mysql_free_result($id);
}
return $res;
}
/* public: find available table names */
function table_names() {
$this->connect();
$h = @mysql_query("show tables", $this->Link_ID);
$i = 0;
while ($info = @mysql_fetch_row($h)) {
$return[$i]["table_name"] = $info[0];
$return[$i]["tablespace_name"] = $this->Database;
$return[$i]["database"] = $this->Database;
$i++;
}
@mysql_free_result($h);
return $return;
}
/* private: error handling */
function halt($msg) {
$this->Error = @mysql_error($this->Link_ID);
$this->Errno = @mysql_errno($this->Link_ID);
if ($this->locked) {
$this->unlock();
}
if ($this->Halt_On_Error == "no")
return;
$this->haltmsg($msg);
if ($this->Halt_On_Error != "report")
die("Session halted.");
}
function haltmsg($msg) {
printf("<p><b>Database error:</b> %s<br>\n", $msg);
printf("<b>MySQL Error</b>: %s (%s)</p>\n",
$this->Errno,
$this->Error);
}
}
$_php_major_version = substr(phpversion(), 0, 1);
if((4 > $_php_major_version) or !class_exists("DB_Sql"))
{
class DB_Sql extends DB_MySQL
{
function DB_Sql($query = "")
{
$this->DB_MySQL($query);
}
}
}
unset($_php_major_version);
?>
@@ -0,0 +1,77 @@
<?
require_once( "common.inc" ); // 공통 함수 모음
require_once( "db_pgsql.inc" ); // 데이터베이스 인터페이스
$uid = isset($_POST['uid']) ? $_POST['uid'] : NULL;
$upw = isset($_POST['upw']) ? $_POST['upw'] : NULL;
$saveid = isset($_POST['saveid']) ? $_POST['saveid'] : NULL;
$userid = addslashes(trim(strtolower("$uid")));
$userpw = addslashes(trim("$upw"));
$objConn = new DB_Sql;
// md5()
$userpw_md5 = md5($userpw);
$sql = " SELECT sp_user_id, sp_user_password ";
$sql .= " FROM t_sp_user ";
$sql .= " WHERE sp_user_id = '$userid' AND sp_user_password = '$userpw_md5' ";
$stmt = $objConn->query($sql);
$saveid = "1";
$super_uid = NULL;
if ($objConn->nf() != 0)
{
$objConn->next_record();
$super_uid = $objConn->f(0);
}
if ( $super_uid )
{
/*쿠키 설정*/
if( $saveid == "1")
{
SetCookie("odid", $userid, time()+3600*24*30, "/");
SetCookie("idsave", "1", time()+3600*24*30, "/");
} else
{
SetCookie("odid", "", time()+3600*24*30, "/");
SetCookie("idsave", "0", time()+3600*24*30, "/");
}
if( $ssl == "1")
{
SetCookie("odssl", $ssl, time()+3600*24*30, "/");
$PT = "https://";
} else
{
SetCookie("odssl", "", time()+3600*24*30, "/");
$PT = "http://";
}
SetCookie("UID", $userid, 0, "/");
$transferURL = "../raid_stat.html";
printf("<script>
location.replace('$transferURL');
</script>");
} else //인증 실패
{
loginError();
}
function loginError()
{
printf(" <script language=\"JavaScript\">\n");
printf(" <!--\n");
printf(" alert('아이디나 패스워드가 잘못되었습니다.');");
printf(" history.back();\n");
printf(" //-->\n");
printf(" </script>\n");
die;
}
?>
@@ -0,0 +1,19 @@
<?php
// 인클루드
require_once( "common.inc" ); // 공통 함수 모음
//if( $HTTP_COOKIE_VARS["UID"] != "" )
if( $_COOKIE["UID"] != "" )
{
SetCookie("UID", "", 0, "/");
SetCookie("odid", "", 0, "/");
SetCookie("idsave", "", 0, "/");
}
printf (" <script>\n ");
printf (" alert('로그아웃 되었습니다.');\n ");
printf (" </script>\n ");
echo (" <script>location.replace('../index.html');</script> ");
?>
@@ -0,0 +1,115 @@
<?php
define('SQL_ASSOC', MYSQL_ASSOC);
define('SQL_NUM', MYSQL_NUM);
define('SQL_BOTH', MYSQL_BOTH);
define('CRLF', "\r\n");
class dbconnect
{
var $showError;
var $dbc;
function dbconnect($host, $user, $pass, $base, $file = '', $line = 0)
{
//echo $host." ".$user." ".$pass;
if(!$this->dbc = @mysql_connect($host, $user, $pass))
{
$error = 'Cannot connect to MySQL server. In file '.$file.' in line '.$line.'. Date: '.date('Y-m-d H:i:s').'<br />'.CRLF;
die($error);
}
if(!@mysql_query("USE ".$base, $this->dbc))
{
$error = 'Error <b>'.mysql_error($this->dbc).'</b> in query <b>'.$query.'</b>. In file '.$file.' in line '.$line.'. Date: '.date('Y-m-d H:i:s').'<br />'.CRLF;
die($error);
}
$this->showError = true;
}
function query($query, $file = '', $line = 0)
{
if(!$result = @mysql_query($query, $this->dbc))
{
$error = 'Error <b>'.mysql_error($this->dbc).'</b> in query <b>'.$query.'</b>. In file '.$file.' in line '.$line.'. Date: '.date('Y-m-d H:i:s').'<br />'.CRLF;
if($this->showError)
{
echo $error;
}
}
return new dbcResult($result);
}
function query_bool($query, $file = '', $line = 0)
{
if(!$result = @mysql_query($query, $this->dbc))
{
$error = 'Error <b>'.mysql_error($this->dbc).'</b> in query <b>'.$query.'</b>. In file '.$file.' in line '.$line.'. Date: '.date('Y-m-d H:i:s').'<br />'.CRLF;
if($this->showError)
{
echo $error;
}
}
return ($result?true:false);
}
function insert_id()
{
$id = $this->firstCell("SELECT LAST_INSERT_ID() as id");
return $id;
}
function fetch_array($query, $type = SQL_BOTH)
{
$result = $this->query($query);
return $result->fetch_array($type);
}
function first_cell($query)
{
$result = $this->query($query);
$row = $result->fetch_array(SQL_NUM);
return $row[0];
}
function change_base($base, $file = '', $line = 0)
{
if(!$result = @mysql_query('USE '.$base, $this->dbc))
{
$error = 'Error <b>'.mysql_error($this->dbc).'</b> in query <b>'.$query.'</b>. In file '.$file.' in line '.$line.'. Date: '.date('Y-m-d H:i:s').'<br />'.CRLF;
if($this->showError)
{
echo $error;
}
}
return ($result?true:false);
}
function close()
{
@mysql_close($this->dbc);
unset($this);
}
}
class dbcResult
{
function dbcResult($result)
{
$this->result = $result;
}
function fetch_array($type = SQL_BOTH)
{
return @mysql_fetch_array($this->result, $type);
}
function first_cell()
{
$row = @mysql_fetch_row($this->result);
return $row[0];
}
function num_rows()
{
return @mysql_num_rows($this->result);
}
}
?>
@@ -0,0 +1,375 @@
<?php
class DB_Sql {
var $Host = "127.0.0.1"; // lgu -> 61.111.52.4
var $Database = "syshost";
var $Port = "5432";
var $User = "syshost";
var $Password = "alfkzmf!?{}";
var $Link_ID = 0;
var $Query_ID = 0;
var $Record = array();
var $Row = 0;
var $Seq_Table = "db_sequence";
var $Errno = 0;
var $Error = "";
var $Debug = 0;
var $Auto_Free = 0; # Set this to 1 for automatic pg_freeresult on
# last record.
var $PConnect = 0; ## Set to 1 to use persistent database connections
function ifadd($add, $me) {
if("" != $add) return " ".$me.$add;
}
/* public: constructor */
function DB_Sql($query = "") {
$this->query($query);
}
function setHostIP($ip = "") {
$this->Host = $ip;
}
function querySafe($string) {
$string = str_replace("'", "\'", $string);
$string = str_replace("\\", "\\\\", $string);
return $string;
}
function connect() {
if ( 0 == $this->Link_ID ) {
$cstr = "dbname=".$this->Database.
$this->ifadd($this->Host, "host=").
$this->ifadd($this->Port, "port=").
$this->ifadd($this->User, "user=").
$this->ifadd($this->Password, "password=");
if(!$this->PConnect) {
$this->Link_ID = pg_connect($cstr);
} else {
$this->Link_ID = pg_pconnect($cstr);
}
if (!$this->Link_ID) {
$this->halt("connect() failed.");
}
}
}
function close() {
pg_close($this->Link_ID);
}
function query($Query_String) {
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;
$this->connect();
if ($this->Debug)
printf("<br>Debug: query = %s<br>\n", $Query_String);
$this->Query_ID = pg_Exec($this->Link_ID, $Query_String);
$this->Row = 0;
$this->Error = pg_ErrorMessage($this->Link_ID);
$this->Errno = ($this->Error == "")?0:1;
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
return $this->Query_ID;
}
function beginTrans() {
return $this->query("begin");
}
function commitTrans() {
return $this->query("commit");
}
function rollbackTrans() {
return $this->query("rollback");
}
function next_record() {
$this->Record = @pg_fetch_array($this->Query_ID, $this->Row++);
$this->Error = pg_ErrorMessage($this->Link_ID);
$this->Errno = ($this->Error == "")?0:1;
$stat = is_array($this->Record);
if (!$stat && $this->Auto_Free) {
pg_freeresult($this->Query_ID);
$this->Query_ID = 0;
}
return $stat;
}
function seek($pos) {
$this->Row = $pos;
}
function lock($table, $mode = "write") {
if ($mode == "write") {
$result = pg_Exec($this->Link_ID, "lock table $table");
} else {
$result = 1;
}
return $result;
}
function unlock() {
return pg_Exec($this->Link_ID, "commit");
}
/* public: sequence numbers */
function nextid($seq_name) {
$this->connect();
if ($this->lock($this->Seq_Table)) {
/* get sequence number (locked) and increment */
$q = sprintf("select nextid from %s where seq_name = '%s'",
$this->Seq_Table,
$seq_name);
$id = @pg_Exec($this->Link_ID, $q);
$res = @pg_Fetch_Array($id, 0);
/* No current value, make one */
if (!is_array($res)) {
$currentid = 0;
$q = sprintf("insert into %s values('%s', %s)",
$this->Seq_Table,
$seq_name,
$currentid);
$id = @pg_Exec($this->Link_ID, $q);
} else {
$currentid = $res["nextid"];
}
$nextid = $currentid + 1;
$q = sprintf("update %s set nextid = '%s' where seq_name = '%s'",
$this->Seq_Table,
$nextid,
$seq_name);
$id = @pg_Exec($this->Link_ID, $q);
$this->unlock();
} else {
$this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
return 0;
}
return $nextid;
}
function metadata($table="") {
$count = 0;
$id = 0;
$res = array();
if ($table) {
$this->connect();
$id = pg_exec($this->Link_ID, "select * from $table");
if ($id < 0) {
$this->Error = pg_ErrorMessage($id);
$this->Errno = 1;
$this->halt("Metadata query failed.");
}
} else {
$id = $this->Query_ID;
if (!$id) {
$this->halt("No query specified.");
}
}
$count = pg_NumFields($id);
for ($i=0; $i<$count; $i++) {
$res[$i]["table"] = $table;
$res[$i]["name"] = pg_FieldName ($id, $i);
$res[$i]["type"] = pg_FieldType ($id, $i);
$res[$i]["len"] = pg_FieldSize ($id, $i);
$res[$i]["flags"] = "";
}
if ($table) {
pg_FreeResult($id);
}
return $res;
}
function affected_rows() {
return pg_cmdtuples($this->Query_ID);
}
function num_rows() {
return pg_numrows($this->Query_ID);
}
function num_fields() {
return pg_numfields($this->Query_ID);
}
function nf() {
return $this->num_rows();
}
function np() {
print $this->num_rows();
}
function tf($Name) {
return $this->Record[$Name];
}
function f($Name) {
if($this->Record[$Name] == "")
{
return;
//return "&nbsp;";
}
else
{
return trim($this->Record[$Name]);
//return $this->Record[$Name];
}
}
function p($Name) {
print $this->Record[$Name];
}
function halt($msg) {
printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
printf("<b>PostgreSQL Error</b>: %s (%s)<br>\n",
$this->Errno,
$this->Error);
die("Session halted.");
}
function table_names() {
$this->query("select relname from pg_class where relkind = 'r' and not relname like 'pg_%'");
$i=0;
while ($this->next_record())
{
$return[$i]["table_name"]= $this->f(0);
$return[$i]["tablespace_name"]=$this->Database;
$return[$i]["database"]=$this->Database;
$i++;
}
return $return;
}
}
function _query_string($method)
{
$params = $_SERVER['QUERY_STRING'];
if( $method = "POST" )
{
if( getenv("REQUEST_METHOD") == "POST" )
{
$params = "$HTTP_POST_VARS";
$params = str_replace("+", "%20", $params);
}
}
return $params;
}
function param_remove($params, $key)
{
$str = split("&", $params);
$str_cnt = sizeof($str);
for( $i=0; $i < $str_cnt; $i++ )
{
$sub_str = split("=", $str[$i]);
if( $sub_str[0] != $key )
{
$qstring .= $str[$i]. "&";
}
}
if( $qstring != "" )
{
$qstring = substr($qstring, 0, strlen($qstring)-1);
}
return $qstring;
}
function sub_page_navigate( $page, $pagecnt, $preimg, $nextimg, $params )
{
$blocknum = (integer)(($page - 1) / 10) + 1;
$spage = ($blocknum-1) * 10 + 1;
$epage = $blocknum * 10;
if( $epage > $pagecnt)
{
$epage = $pagecnt;
}
$cur_url = $_SERVER['PHP_SELF'];
if($params != "") $params = "&".$params;
if($spage > 10) //' ÀÌÀü 10°³
{
if($preimg == "")
{
printf("<a href='".$cur_url."?page=".($spage-10).$params.">¢¸</a>&nbsp;");
}else
{
printf("<a href=".$cur_url."?page=".($spage-10).$params.">".$preimg."</a>&nbsp;");
}
}else
{
if($preimg == "")
{
printf("¢¸&nbsp;");
}else
{
printf($preimg."&nbsp;");
}
}
for($i = $spage; $i <= $epage; $i++)
{
if($i == $page)
{
printf("&nbsp;<b>".$i."</b>&nbsp;");
}else
{
printf("&nbsp;<a href=".$cur_url."?page=".$i.$params.">".$i."</a>&nbsp;");
}
}
if($epage < $pagecnt)
{
if($nextimg == "")
{
printf("&nbsp;<a href=".$cur_url."?page=".($epage+1).$params.">¢º</a>");
}else
{
printf("&nbsp;<a href=".$cur_url."?page=".($epage+1).$params.">".$nextimg."</a>");
}
}else
{
if($nextimg == "")
{
printf("&nbsp;¢º");
}else
{
printf("&nbsp;".$nextimg);
}
}
}
?>
@@ -0,0 +1,371 @@
<?php
class DB_Sql {
var $Host = "127.0.0.1";
var $Database = "syshost";
var $Port = "5432";
var $User = "syshost";
var $Password = "alfkzmf!?{}";
var $Link_ID = 0;
var $Query_ID = 0;
var $Record = array();
var $Row = 0;
var $Seq_Table = "db_sequence";
var $Errno = 0;
var $Error = "";
var $Debug = 0;
var $Auto_Free = 0; # Set this to 1 for automatic pg_freeresult on
# last record.
var $PConnect = 0; ## Set to 1 to use persistent database connections
function ifadd($add, $me) {
if("" != $add) return " ".$me.$add;
}
/* public: constructor */
function DB_Sql($query = "") {
$this->query($query);
}
function querySafe($string) {
$string = str_replace("'", "\'", $string);
$string = str_replace("\\", "\\\\", $string);
return $string;
}
function connect() {
if ( 0 == $this->Link_ID ) {
$cstr = "dbname=".$this->Database.
$this->ifadd($this->Host, "host=").
$this->ifadd($this->Port, "port=").
$this->ifadd($this->User, "user=").
$this->ifadd($this->Password, "password=");
if(!$this->PConnect) {
$this->Link_ID = pg_connect($cstr);
} else {
$this->Link_ID = pg_pconnect($cstr);
}
if (!$this->Link_ID) {
$this->halt("connect() failed.");
}
}
}
function close() {
pg_close($this->Link_ID);
}
function query($Query_String) {
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;
$this->connect();
if ($this->Debug)
printf("<br>Debug: query = %s<br>\n", $Query_String);
$this->Query_ID = pg_Exec($this->Link_ID, $Query_String);
$this->Row = 0;
$this->Error = pg_ErrorMessage($this->Link_ID);
$this->Errno = ($this->Error == "")?0:1;
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
return $this->Query_ID;
}
function beginTrans() {
return $this->query("begin");
}
function commitTrans() {
return $this->query("commit");
}
function rollbackTrans() {
return $this->query("rollback");
}
function next_record() {
$this->Record = @pg_fetch_array($this->Query_ID, $this->Row++);
$this->Error = pg_ErrorMessage($this->Link_ID);
$this->Errno = ($this->Error == "")?0:1;
$stat = is_array($this->Record);
if (!$stat && $this->Auto_Free) {
pg_freeresult($this->Query_ID);
$this->Query_ID = 0;
}
return $stat;
}
function seek($pos) {
$this->Row = $pos;
}
function lock($table, $mode = "write") {
if ($mode == "write") {
$result = pg_Exec($this->Link_ID, "lock table $table");
} else {
$result = 1;
}
return $result;
}
function unlock() {
return pg_Exec($this->Link_ID, "commit");
}
/* public: sequence numbers */
function nextid($seq_name) {
$this->connect();
if ($this->lock($this->Seq_Table)) {
/* get sequence number (locked) and increment */
$q = sprintf("select nextid from %s where seq_name = '%s'",
$this->Seq_Table,
$seq_name);
$id = @pg_Exec($this->Link_ID, $q);
$res = @pg_Fetch_Array($id, 0);
/* No current value, make one */
if (!is_array($res)) {
$currentid = 0;
$q = sprintf("insert into %s values('%s', %s)",
$this->Seq_Table,
$seq_name,
$currentid);
$id = @pg_Exec($this->Link_ID, $q);
} else {
$currentid = $res["nextid"];
}
$nextid = $currentid + 1;
$q = sprintf("update %s set nextid = '%s' where seq_name = '%s'",
$this->Seq_Table,
$nextid,
$seq_name);
$id = @pg_Exec($this->Link_ID, $q);
$this->unlock();
} else {
$this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
return 0;
}
return $nextid;
}
function metadata($table="") {
$count = 0;
$id = 0;
$res = array();
if ($table) {
$this->connect();
$id = pg_exec($this->Link_ID, "select * from $table");
if ($id < 0) {
$this->Error = pg_ErrorMessage($id);
$this->Errno = 1;
$this->halt("Metadata query failed.");
}
} else {
$id = $this->Query_ID;
if (!$id) {
$this->halt("No query specified.");
}
}
$count = pg_NumFields($id);
for ($i=0; $i<$count; $i++) {
$res[$i]["table"] = $table;
$res[$i]["name"] = pg_FieldName ($id, $i);
$res[$i]["type"] = pg_FieldType ($id, $i);
$res[$i]["len"] = pg_FieldSize ($id, $i);
$res[$i]["flags"] = "";
}
if ($table) {
pg_FreeResult($id);
}
return $res;
}
function affected_rows() {
return pg_cmdtuples($this->Query_ID);
}
function num_rows() {
return pg_numrows($this->Query_ID);
}
function num_fields() {
return pg_numfields($this->Query_ID);
}
function nf() {
return $this->num_rows();
}
function np() {
print $this->num_rows();
}
function tf($Name) {
return $this->Record[$Name];
}
function f($Name) {
if($this->Record[$Name] == "")
{
return;
//return "&nbsp;";
}
else
{
return trim($this->Record[$Name]);
//return $this->Record[$Name];
}
}
function p($Name) {
print $this->Record[$Name];
}
function halt($msg) {
printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
printf("<b>PostgreSQL Error</b>: %s (%s)<br>\n",
$this->Errno,
$this->Error);
die("Session halted.");
}
function table_names() {
$this->query("select relname from pg_class where relkind = 'r' and not relname like 'pg_%'");
$i=0;
while ($this->next_record())
{
$return[$i]["table_name"]= $this->f(0);
$return[$i]["tablespace_name"]=$this->Database;
$return[$i]["database"]=$this->Database;
$i++;
}
return $return;
}
}
function _query_string($method)
{
$params = $_SERVER['QUERY_STRING'];
if( $method = "POST" )
{
if( getenv("REQUEST_METHOD") == "POST" )
{
$params = "$HTTP_POST_VARS";
$params = str_replace("+", "%20", $params);
}
}
return $params;
}
function param_remove($params, $key)
{
$str = split("&", $params);
$str_cnt = sizeof($str);
for( $i=0; $i < $str_cnt; $i++ )
{
$sub_str = split("=", $str[$i]);
if( $sub_str[0] != $key )
{
$qstring .= $str[$i]. "&";
}
}
if( $qstring != "" )
{
$qstring = substr($qstring, 0, strlen($qstring)-1);
}
return $qstring;
}
function sub_page_navigate( $page, $pagecnt, $preimg, $nextimg, $params )
{
$blocknum = (integer)(($page - 1) / 10) + 1;
$spage = ($blocknum-1) * 10 + 1;
$epage = $blocknum * 10;
if( $epage > $pagecnt)
{
$epage = $pagecnt;
}
$cur_url = $_SERVER['PHP_SELF'];
if($params != "") $params = "&".$params;
if($spage > 10) //' ÀÌÀü 10°³
{
if($preimg == "")
{
printf("<a href='".$cur_url."?page=".($spage-10).$params.">¢¸</a>&nbsp;");
}else
{
printf("<a href=".$cur_url."?page=".($spage-10).$params.">".$preimg."</a>&nbsp;");
}
}else
{
if($preimg == "")
{
printf("¢¸&nbsp;");
}else
{
printf($preimg."&nbsp;");
}
}
for($i = $spage; $i <= $epage; $i++)
{
if($i == $page)
{
printf("&nbsp;<b>".$i."</b>&nbsp;");
}else
{
printf("&nbsp;<a href=".$cur_url."?page=".$i.$params.">".$i."</a>&nbsp;");
}
}
if($epage < $pagecnt)
{
if($nextimg == "")
{
printf("&nbsp;<a href=".$cur_url."?page=".($epage+1).$params.">¢º</a>");
}else
{
printf("&nbsp;<a href=".$cur_url."?page=".($epage+1).$params.">".$nextimg."</a>");
}
}else
{
if($nextimg == "")
{
printf("&nbsp;¢º");
}else
{
printf("&nbsp;".$nextimg);
}
}
}
?>
@@ -0,0 +1,657 @@
<?php
//function MakeHtmlBodyFromArcmondClient($ip= NULL,$port ="8787",$cmd_seq ="2")
function MakeHtmlBodyFromArcmondClient($ip= NULL,$port ="8787",$cmd_seq ="EVENT:INFO:ALL")
{
if ($ip != NULL)
{
sleep(5); // FHS SETTING VALUE (default:30)
$command = "../inc/arcmond_client $ip $port $cmd_seq";
exec($command, $raid_res);
$raid_str = explode(":", $raid_res[0]);
$body = "<table border=\"1\" width=\"565\" cellspacing=\"0\" cellpadding=\"0\">";
$body .= " <tr>";
$body .= " <td colspan=\"2\">";
$body .= " <font size=3><b>IP : $ip</b></font> Checked at ".date("Y-m-d H:i:s", $raid_str[1])." <br> ";
$body .= " </td>";
$body .= " </tr>";
$to_eli = $raid_str[0].":".$raid_str[1].":";
$raid_res[0] = str_replace($to_eli,"",$raid_res[0]); // remove header phase
$tot = count($raid_res);
for($i=0; $i < $tot; $i++) {
$raid_res2 = explode("] ", str_replace("[", "", trim($raid_res[$i])));
echo $raid_res2[0]."<br>";
if($raid_res2[0] != "" && substr_count($raid_res2[0], "Disabled") == 0) {
$body .= " <tr>";
$body .= " <td width=\"160\" align=\"center\">".$raid_res2[0];
$body .= " </td>";
$body .= " <td>&nbsp;".$raid_res2[1];
$body .= " </td>";
$body .= " </tr>";
}else if(substr_count($raid_res2[0], "Disabled") > 0) {
$body .= " <tr>";
$body .= " <td align=\"center\" colspan=\"2\">\n".$raid_res2[0];
$body .= " </td>";
$body .= " </tr>";
}
}
$body .= "</table>";
} else {
$body = "Fail to detail log!!";
}
//echo $body;
return $body;
}
function htmlBody($ip)
{
if($ip != "")
{
// sleep(1); // FHS SETTING VALUE (default:30)
$thisfilename=basename(__FILE__);
$temp_filename=realpath(__FILE__);
if(!$temp_filename)
$temp_filename=__FILE__;
$osdir=eregi_replace($thisfilename,"",$temp_filename);
//$command = $osdir . "arcmond_client $ip 8787 2";
$command = $osdir . "arcmond_client $ip 8787 EVENT:INFO:ALL";
exec($command, $raid_res);
$raid_str = explode(":", $raid_res[0]);
$body = "<table border=\"1\" width=\"565\" cellspacing=\"0\" cellpadding=\"0\">";
$body .= " <tr>";
$body .= " <td colspan=\"2\">";
$body .= " <font size=3><b>IP : $ip</b></font> Checked at ".date("Y-m-d H:i:s", $raid_str[1])." <br> ";
$body .= " </td>";
$body .= " </tr>";
$to_eli = $raid_str[0].":".$raid_str[1].":";
$raid_res[0] = str_replace($to_eli,"",$raid_res[0]);
$tot = count($raid_res);
for($i=0; $i < $tot; $i++)
{
$raid_res2 = explode("] ", str_replace("[", "", trim($raid_res[$i])));
if($raid_res2[0] != "" && substr_count($raid_res2[0], "Disabled") == 0) {
$body .= " <tr>";
$body .= " <td width=\"160\" align=\"center\">".$raid_res2[0];
$body .= " </td>";
$body .= " <td>&nbsp;".$raid_res2[1];
$body .= " </td>";
$body .= " </tr>";
}else if(substr_count($raid_res2[0], "Disabled") > 0) {
$body .= " <tr>";
$body .= " <td align=\"center\" colspan=\"2\">\n".$raid_res2[0];
$body .= " </td>";
$body .= " </tr>";
}
}
$body .= "</table>";
} else {
$body = "Fail to detail log!!";
}
//echo $body;
return $body;
}
class Smtp {
var $host;
var $fp;
var $self;
var $lastmsg;
var $parts;
var $error;
var $debug;
var $charset;
var $ctype;
function Smtp($host="self") {
if($host == "self") $this->self = true;
else $this->host = $host;
$this->parts = array();
$this->error = array();
$$this->debug = 0;
$this->charset = "euc-kr";
$this->ctype = "text/html";
}
// 디버그 모드 : 1
function debug($n=1) {
$this->debug = $n;
}
// smtp 통신을 한다.
function dialogue($code, $cmd) {
fputs($this->fp, $cmd."\r\n");
$line = fgets($this->fp, 1024);
ereg("^([0-9]+).(.*)$", $line, &$data);
$this->lastmsg = $data[0];
if($this->debug) {
echo htmlspecialchars($cmd)."<br>".$this->lastmsg."<br>";
flush();
}
if($data[1] != $code) return false;
return true;
}
// smptp 서버에 접속을 한다.
function smtp_connect($host) {
if($this->debug) {
echo "SMTP($host) Connecting...<br>";
flush();
}
if(!$host) $host = $this->host;
if(!$this->fp = fsockopen($host, 25, $errno, $errstr, 10)) {
$this->lastmsg = "SMTP($host) 서버접속에 실패했습니다.[$errno:$errstr]";
return false;
}
$line = fgets($this->fp, 1024);
ereg("^([0-9]+).(.*)$", $line, &$data);
$this->lastmsg = $data[0];
if($data[1] != "220") return false;
if($this->debug) {
echo $this->lastmsg."<br>";
flush();
}
$this->dialogue(250, "HELO phpmail");
return true;
}
// stmp 서버와의 접속을 끊는다.
function smtp_close() {
$this->dialogue(221, "QUIT");
fclose($this->fp);
return true;
}
// 메시지를 보낸다.
function smtp_send($email, $from, $data) {
if(!$mail_from = $this->get_email($from)) return false;
if(!$rcpt_to = $this->get_email($email)) return false;
if(!$this->dialogue(250, "MAIL FROM: $mail_from"))
$this->error[] = $email.":MAIL FROM 실패($this->lastmsg)";
if(!$this->dialogue(250, "RCPT TO: $rcpt_to"))
$this->error[] = $email.":RCPT TO 실패($this->lastmsg)";
$this->dialogue(354, "DATA");
$mime = "Message-ID: <".$this->get_message_id().">\r\n";
$mime .= "From: $from\r\n";
$mime .= "To: $email\r\n";
fputs($this->fp, $mime);
fputs($this->fp, $data);
$this->dialogue(250, ".");
}
// Message ID 를 얻는다.
function get_message_id() {
$id = date("YmdHis",time());
mt_srand((float) microtime() * 1000000);
$randval = mt_rand();
$id .= $randval."@phpmail";
return $id;
}
// Boundary 값을 얻는다.
function get_boundary() {
$uniqchr = uniqid(time());
$one = strtoupper($uniqchr[0]);
$two = strtoupper(substr($uniqchr,0,8));
$three = strtoupper(substr(strrev($uniqchr),0,8));
return "----=_NextPart_000_000${one}_${two}.${three}";
}
// 첨부파일이 있을 경우 이 함수를 이용해 파일을 첨부한다.
function attach($message, $name="", $ctype="application/octet-stream") {
$this->parts[] = array ("ctype" => $ctype, "message" => $message, "name" => $name);
}
// Multipart 메시지를 생성시킨다.
function build_message($part) {
$msg .= "Content-Type: ".$part['ctype'];
if($part['name']) $msg .= "; name=\"".$part['name']."\"";
$msg .= "\r\nContent-Transfer-Encoding: base64\r\n";
$msg .= "Content-Disposition: attachment; filename=\"".$part['name']."\"\r\n\r\n";
$msg .= chunk_split(base64_encode($part['message']));
return $msg;
}
// SMTP에 보낼 DATA를 생성시킨다.
function build_data($subject, $body) {
$boundary = $this->get_boundary();
$mime .= "Subject: $subject\r\n";
$mime .= "Date: ".date ("D, j M Y H:i:s T",time())."\r\n";
$mime .= "MIME-Version: 1.0\r\n";
$mime .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"\r\n\r\n".
"This is a multi-part message in MIME format.\r\n\r\n";
$mime .= "--".$boundary."\r\n".
"Content-Type: ".$this->ctype."; charset=\"".$this->charset."\"\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n".
chunk_split(base64_encode($body)).
"\r\n\r\n--".$boundary;
$max = count($this->parts);
for($i=0; $i<$max; $i++) {
$mime .= "\r\n".$this->build_message($this->parts[$i])."\r\n\r\n--".$boundary;
}
$mime .= "--\r\n";
return $mime;
}
// MX 값을 찾는다.
function get_mx_server($email) {
if(!ereg("([\._0-9a-zA-Z-]+)@([0-9a-zA-Z-]+\.[a-zA-Z\.]+)", $email, $reg)) return false;
getmxrr($reg[2], $host);
if(!$host) $host[0] = $reg[2];
return $host;
}
// 이메일의 형식이 맞는지 체크한다.
function get_email($email) {
if(!ereg("([\._0-9a-zA-Z-]+)@([0-9a-zA-Z-]+\.[a-zA-Z\.]+)", $email, $reg)) return false;
return "<".$reg[0].">";
}
// 메일을 전송한다.
function send($to, $from, $subject, $body) {
if(!is_array($to)) $to = split("[,;]",$to);
if($this->self) {
$data = $this->build_data($subject, $body);
foreach($to as $email) {
if($host = $this->get_mx_server($email)) {
$flag = false; $i = 0;
while($flag == false) {
if($host[$i]) {
$flag = $this->smtp_connect($host[$i]);
$i++;
echo "-----------> $i";
} else break;
}
if($flag) {
$this->smtp_send($email, $from, $data);
$this->smtp_close();
} else {
$this->error[] = $email.":SMTP 접속실패";
}
} else {
$this->error[] = $email.":형식이 잘못됨";
}
}
} else {
if(!$this->smtp_connect($this->host)) {
$this->error[] = "$this->host SMTP 접속실패";
return false;
}
$data = $this->build_data($subject, $body);
foreach($to as $email) $this->smtp_send($email, $from, $data);
$this->smtp_close();
}
}
}
/*-----------------------------------------사용법--------------------------------------------*/
/*
$mail = new Smtp("mail.solutionbox.co.kr");
//$mail->debug();
$mail->send("mirshead@solutionbox.co.kr", "mirshead@solutionbox.co.kr", "이 메일은 정상입니다.", "정상적인 메일이니 삭제하지 마십시오.");
*/
/*-----------------------------------------사용법--------------------------------------------*/
class mime
{
protected $mime_version = "1.0";
protected $mime_content_type = "text/plain";
protected $mime_charset = "ks_c_5601-1987";
protected $mime_encoding = "base64";
protected $mime_boundary = null;
protected $mime_xmailer = null;
public function __construct()
{
}
public function set_content_type($content_type = null)
{
$this->mime_content_type = $content_type != null ? $content_type : "text/html";
}
public function set_charset($charset = null)
{
$this->mime_charset = $charset != null ? $charset : "euc_kr";
}
public function set_boundary($boundary = null)
{
$this->mime_boundary = $boundary ? $boundary : null;
}
public function set_encoding($encoding = null)
{
$this->mime_encoding = $encoding != null ? $encoding : "base64";
}
public function set_xmailer($xmailer = null)
{
$this->mime_xmailer = $xmailer != null ? $xmailer : $_SERVER['HTTP_USER_AGENT'];
}
public function __destruct()
{
}
}
class sendmail extends mime
{
protected $smtp_server = null;
protected $smtp_port = 0;
protected $smtp_timeout = 0;
protected $smtp_socketopen = 0;
protected $smtp_status = false;
protected $smtp_CRLF = "\r\n";
protected $smtp_attachfile_name = null;
protected $smtp_attachfile_size = 0;
protected $smtp_attachfile_type = null;
protected $smtp_cmd_status = array();
protected $mail_from = null;
protected $mail_to = null;
protected $mail_subject = null;
protected $mail_priority = 3;
protected $mail_notification = 0;
protected $mail_body = null;
public function __construct($server = null, $port = 0, $timeout = 0)
{
$this->smtp_server = ($server != null) ? $server : "localhost";
$this->smtp_port = ($port != 0) ? $port : 25;
$this->smtp_timeout = ($timeout != 0) ? $timeout : 30;
}
public function encoding($str)
{
return "=?ks_c_5601-1987?B?" . base64_encode($str) . "?=";
}
private function _mail_env ($to, $from, $subject, $body, $priority = 3, $notification = 0)
{
$this->mail_from = $from;
$this->mail_to = $to;
$this->mail_subject = $subject;
$this->mail_body = $body;
$this->mail_priority = $priority;
$this->mail_notification = $notification;
}
private function _smtp_base_header()
{
$this->_smtp_cmd("From: $this->mail_from");
$this->_smtp_cmd("To: $this->mail_to");
$this->_smtp_cmd("Subject: $this->mail_subject");
$this->_smtp_cmd("MIME-Version: $this->mime_version");
$this->_smtp_cmd("X-Priority: $this->mail_priority");
$this->_smtp_cmd("X-Mailer: $this->mime_xmailer");
}
private function _smtp_base_content()
{
$this->_smtp_cmd("Content-Type: $this->mime_content_type; charset=\"$this->mime_charset\"");
$this->_smtp_cmd("Content-Transfer-Encoding: $this->mime_encoding");
}
private function _smtp_multipart_content($attach = false)
{
if($attach)
{
$this->_smtp_cmd("Content-Type: multipart/mixed; boundary=\"$this->mime_boundary\"");
} else {
$this->_smtp_cmd("Content-Type: multipart/alternative; boundary=\"$this->mime_boundary\"");
}
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd("This is a multi-part message in MIME format.");
}
private function _smtp_attachfile_content()
{
$this->_smtp_cmd("Content-Type: $this->smtp_attachfile_type");
$this->_smtp_cmd("Content-Transfer-Encoding: $this->mime_encoding");
$this->_smtp_cmd("Content-Disposition: attachment; filename=\"$this->smtp_attachfile_name\"");
}
private function _smtp_start_boundary()
{
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd("--$this->mime_boundary");
}
private function _smtp_end_boundary()
{
$this->_smtp_cmd("--$this->mime_boundary--");
}
public function open()
{
$this->smtp_socketopen = @fsockopen($this->smtp_server, $this->smtp_port, $errno, $errstr, $this->smtp_timeout);
if($this->_smtp_code($this->_receive()) != 220)
{
throw new Exception("..... ... . .....");
}
else
{
$this->smtp_status = true;
}
return $this->smtp_status;
}
private function _smtp_helo()
{
$this->_smtp_cmd("HELO $this->smtp_server");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_mailfrom($from)
{
$this->_smtp_cmd("MAIL FROM: $this->mail_from");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_rcptto($to)
{
$this->_smtp_cmd("RCPT TO: $this->mail_to");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_data()
{
$this->_smtp_cmd("DATA");
if($this->_smtp_code($this->_receive()) == 354)
{
return true;
}
return false;
}
private function _smtp_end()
{
$this->_smtp_cmd(".");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_quit()
{
$this->_smtp_cmd("QUIT");
if($this->_smtp_code($this->_receive()) == 221)
{
return true;
}
return false;
}
public function close()
{
if(@fclose($this->smtp_socketopen) == false)
{
throw new Exception(".. ..... ...... .....");
}
return true;
}
private function _smtp_send($files = null)
{
$this->mime_boundary = "======" . uniqid(rand()) . "/$_SERVER[SERVER_NAME]";
$mail_body = nl2br(stripslashes($this->mail_body));
if($this->mime_encoding == "base64")
{
$mail_body = chunk_split(base64_encode($mail_body));
}
$this->smtp_cmd_status[] = $this->_smtp_helo();
$this->smtp_cmd_status[] = $this->_smtp_mailfrom($this->mail_from);
$this->smtp_cmd_status[] = $this->_smtp_rcptto($this->mail_to);
$this->smtp_cmd_status[] = $this->_smtp_data();
$this->_smtp_base_header();
if(is_array($files))
{
$this->_smtp_multipart_content(true);
$this->_smtp_start_boundary();
$this->_smtp_base_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($mail_body);
$this->_smtp_cmd("$this->smtp_CRLF");
for($i = 0; $i < sizeof($files); $i++)
{
if(is_uploaded_file($files[tmp_name][$i]))
{
$this->smtp_attachfile_name = $this->_check_empty($files[name][$i]);
$this->smtp_attachfile_size = $files[size][$i];
$this->smtp_attachfile_type = $files[type][$i];
$attachfile_handle = @fopen($files[tmp_name][$i], "r");
$attachfile_body = @fread($attachfile_handle, $files[size][$i]);
if($this->mime_encoding == "base64")
{
$attachfile_body = chunk_split(base64_encode($attachfile_body));
}
$this->_smtp_start_boundary();
$this->_smtp_attachfile_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($attachfile_body);
$this->_smtp_cmd("$this->smtp_CRLF");
@fclose($attachfile_handle);
}
}
} else {
$this->_smtp_multipart_content(false);
$this->mime_content_type = "text/plain";
$this->_smtp_start_boundary();
$this->_smtp_base_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($mail_body);
$this->_smtp_cmd("$this->smtp_CRLF");
$this->mime_content_type = "text/html";
$this->_smtp_start_boundary();
$this->_smtp_base_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($mail_body);
$this->_smtp_cmd("$this->smtp_CRLF");
}
$this->_smtp_end_boundary();
$this->smtp_cmd_status[] = $this->_smtp_end();
$this->smtp_cmd_status[] = $this->_smtp_quit();
foreach($this->smtp_cmd_status as $key => $value)
{
if($value == false)
{
return false;
break;
}
}
return true;
}
private function _smtp_cmd($str)
{
@fputs($this->smtp_socketopen, $str . $this->smtp_CRLF);
}
private function _smtp_code($str)
{
return substr($str, 0, 3);
}
private function _receive()
{
return @fgets($this->smtp_socketopen, 1024);
}
private function _check_empty($filename)
{
return preg_replace("/ /i", "_", $filename);
}
public function send($to, $from, $subject, $text, $priority = 3, $files = null)
{
$this->set_xmailer($_SERVER[HTTP_USER_AGENT]);
$this->set_content_type("text/html");
$this->set_charset("euc_kr");
$this->set_encoding("base64");
$this->_mail_env($to, $from, $this->encoding($subject), $text, $priority);
if($this->_smtp_send($files) == false)
{
throw new Exception("Error");
}
}
public function __destruct()
{
}
};
?>
@@ -0,0 +1,602 @@
<?php
function htmlBody($ip)
{
if($ip != "") {
sleep(5);
$command = "../bin/arcmond_client $ip 8787 2";
exec($command, $raid_res);
$raid_str = explode(":", $raid_res[0]);
$body = "<table border=\"1\" width=\"565\" cellspacing=\"0\" cellpadding=\"0\">";
$body .= " <tr>";
$body .= " <td colspan=\"2\">";
$body .= " <font size=3><b>IP : $ip</b></font> Checked at ".date("Y-m-d H:i:s", $raid_str[1])." <br> ";
$body .= " </td>";
$body .= " </tr>";
$to_eli = $raid_str[0].":".$raid_str[1].":";
$raid_res[0] = str_replace($to_eli,"",$raid_res[0]);
$tot = count($raid_res);
for($i=0; $i < $tot; $i++) {
$raid_res2 = explode("] ", str_replace("[", "", trim($raid_res[$i])));
if($raid_res2[0] != "" && substr_count($raid_res2[0], "Disabled") == 0) {
$body .= " <tr>";
$body .= " <td width=\"160\" align=\"center\">".$raid_res2[0];
$body .= " </td>";
$body .= " <td>&nbsp;".$raid_res2[1];
$body .= " </td>";
$body .= " </tr>";
}else if(substr_count($raid_res2[0], "Disabled") > 0) {
$body .= " <tr>";
$body .= " <td align=\"center\" colspan=\"2\">\n".$raid_res2[0];
$body .= " </td>";
$body .= " </tr>";
}
}
$body .= "</table>";
} else {
$body = "Fail to detail log!!";
}
//echo $body;
return $body;
}
class Smtp {
var $host;
var $fp;
var $self;
var $lastmsg;
var $parts;
var $error;
var $debug;
var $charset;
var $ctype;
function Smtp($host="self") {
if($host == "self") $this->self = true;
else $this->host = $host;
$this->parts = array();
$this->error = array();
$$this->debug = 0;
$this->charset = "euc-kr";
$this->ctype = "text/html";
}
// 디버그 모드 : 1
function debug($n=1) {
$this->debug = $n;
}
// smtp 통신을 한다.
function dialogue($code, $cmd) {
fputs($this->fp, $cmd."\r\n");
$line = fgets($this->fp, 1024);
ereg("^([0-9]+).(.*)$", $line, &$data);
$this->lastmsg = $data[0];
if($this->debug) {
echo htmlspecialchars($cmd)."<br>".$this->lastmsg."<br>";
flush();
}
if($data[1] != $code) return false;
return true;
}
// smptp 서버에 접속을 한다.
function smtp_connect($host) {
if($this->debug) {
echo "SMTP($host) Connecting...<br>";
flush();
}
if(!$host) $host = $this->host;
if(!$this->fp = fsockopen($host, 25, $errno, $errstr, 10)) {
$this->lastmsg = "SMTP($host) 서버접속에 실패했습니다.[$errno:$errstr]";
return false;
}
$line = fgets($this->fp, 1024);
ereg("^([0-9]+).(.*)$", $line, &$data);
$this->lastmsg = $data[0];
if($data[1] != "220") return false;
if($this->debug) {
echo $this->lastmsg."<br>";
flush();
}
$this->dialogue(250, "HELO phpmail");
return true;
}
// stmp 서버와의 접속을 끊는다.
function smtp_close() {
$this->dialogue(221, "QUIT");
fclose($this->fp);
return true;
}
// 메시지를 보낸다.
function smtp_send($email, $from, $data) {
if(!$mail_from = $this->get_email($from)) return false;
if(!$rcpt_to = $this->get_email($email)) return false;
if(!$this->dialogue(250, "MAIL FROM: $mail_from"))
$this->error[] = $email.":MAIL FROM 실패($this->lastmsg)";
if(!$this->dialogue(250, "RCPT TO: $rcpt_to"))
$this->error[] = $email.":RCPT TO 실패($this->lastmsg)";
$this->dialogue(354, "DATA");
$mime = "Message-ID: <".$this->get_message_id().">\r\n";
$mime .= "From: $from\r\n";
$mime .= "To: $email\r\n";
fputs($this->fp, $mime);
fputs($this->fp, $data);
$this->dialogue(250, ".");
}
// Message ID 를 얻는다.
function get_message_id() {
$id = date("YmdHis",time());
mt_srand((float) microtime() * 1000000);
$randval = mt_rand();
$id .= $randval."@phpmail";
return $id;
}
// Boundary 값을 얻는다.
function get_boundary() {
$uniqchr = uniqid(time());
$one = strtoupper($uniqchr[0]);
$two = strtoupper(substr($uniqchr,0,8));
$three = strtoupper(substr(strrev($uniqchr),0,8));
return "----=_NextPart_000_000${one}_${two}.${three}";
}
// 첨부파일이 있을 경우 이 함수를 이용해 파일을 첨부한다.
function attach($message, $name="", $ctype="application/octet-stream") {
$this->parts[] = array ("ctype" => $ctype, "message" => $message, "name" => $name);
}
// Multipart 메시지를 생성시킨다.
function build_message($part) {
$msg .= "Content-Type: ".$part['ctype'];
if($part['name']) $msg .= "; name=\"".$part['name']."\"";
$msg .= "\r\nContent-Transfer-Encoding: base64\r\n";
$msg .= "Content-Disposition: attachment; filename=\"".$part['name']."\"\r\n\r\n";
$msg .= chunk_split(base64_encode($part['message']));
return $msg;
}
// SMTP에 보낼 DATA를 생성시킨다.
function build_data($subject, $body) {
$boundary = $this->get_boundary();
$mime .= "Subject: $subject\r\n";
$mime .= "Date: ".date ("D, j M Y H:i:s T",time())."\r\n";
$mime .= "MIME-Version: 1.0\r\n";
$mime .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"\r\n\r\n".
"This is a multi-part message in MIME format.\r\n\r\n";
$mime .= "--".$boundary."\r\n".
"Content-Type: ".$this->ctype."; charset=\"".$this->charset."\"\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n".
chunk_split(base64_encode($body)).
"\r\n\r\n--".$boundary;
$max = count($this->parts);
for($i=0; $i<$max; $i++) {
$mime .= "\r\n".$this->build_message($this->parts[$i])."\r\n\r\n--".$boundary;
}
$mime .= "--\r\n";
return $mime;
}
// MX 값을 찾는다.
function get_mx_server($email) {
if(!ereg("([\._0-9a-zA-Z-]+)@([0-9a-zA-Z-]+\.[a-zA-Z\.]+)", $email, $reg)) return false;
getmxrr($reg[2], $host);
if(!$host) $host[0] = $reg[2];
return $host;
}
// 이메일의 형식이 맞는지 체크한다.
function get_email($email) {
if(!ereg("([\._0-9a-zA-Z-]+)@([0-9a-zA-Z-]+\.[a-zA-Z\.]+)", $email, $reg)) return false;
return "<".$reg[0].">";
}
// 메일을 전송한다.
function send($to, $from, $subject, $body) {
if(!is_array($to)) $to = split("[,;]",$to);
if($this->self) {
$data = $this->build_data($subject, $body);
foreach($to as $email) {
if($host = $this->get_mx_server($email)) {
$flag = false; $i = 0;
while($flag == false) {
if($host[$i]) {
$flag = $this->smtp_connect($host[$i]);
$i++;
echo "-----------> $i";
} else break;
}
if($flag) {
$this->smtp_send($email, $from, $data);
$this->smtp_close();
} else {
$this->error[] = $email.":SMTP 접속실패";
}
} else {
$this->error[] = $email.":형식이 잘못됨";
}
}
} else {
if(!$this->smtp_connect($this->host)) {
$this->error[] = "$this->host SMTP 접속실패";
return false;
}
$data = $this->build_data($subject, $body);
foreach($to as $email) $this->smtp_send($email, $from, $data);
$this->smtp_close();
}
}
}
/*-----------------------------------------사용법--------------------------------------------*/
/*
$mail = new Smtp("mail.solutionbox.co.kr");
//$mail->debug();
$mail->send("mirshead@solutionbox.co.kr", "mirshead@solutionbox.co.kr", "이 메일은 정상입니다.", "정상적인 메일이니 삭제하지 마십시오.");
*/
/*-----------------------------------------사용법--------------------------------------------*/
class mime
{
protected $mime_version = "1.0";
protected $mime_content_type = "text/plain";
protected $mime_charset = "ks_c_5601-1987";
protected $mime_encoding = "base64";
protected $mime_boundary = null;
protected $mime_xmailer = null;
public function __construct()
{
}
public function set_content_type($content_type = null)
{
$this->mime_content_type = $content_type != null ? $content_type : "text/html";
}
public function set_charset($charset = null)
{
$this->mime_charset = $charset != null ? $charset : "euc_kr";
}
public function set_boundary($boundary = null)
{
$this->mime_boundary = $boundary ? $boundary : null;
}
public function set_encoding($encoding = null)
{
$this->mime_encoding = $encoding != null ? $encoding : "base64";
}
public function set_xmailer($xmailer = null)
{
$this->mime_xmailer = $xmailer != null ? $xmailer : $_SERVER['HTTP_USER_AGENT'];
}
public function __destruct()
{
}
}
class sendmail extends mime
{
protected $smtp_server = null;
protected $smtp_port = 0;
protected $smtp_timeout = 0;
protected $smtp_socketopen = 0;
protected $smtp_status = false;
protected $smtp_CRLF = "\r\n";
protected $smtp_attachfile_name = null;
protected $smtp_attachfile_size = 0;
protected $smtp_attachfile_type = null;
protected $smtp_cmd_status = array();
protected $mail_from = null;
protected $mail_to = null;
protected $mail_subject = null;
protected $mail_priority = 3;
protected $mail_notification = 0;
protected $mail_body = null;
public function __construct($server = null, $port = 0, $timeout = 0)
{
$this->smtp_server = ($server != null) ? $server : "localhost";
$this->smtp_port = ($port != 0) ? $port : 25;
$this->smtp_timeout = ($timeout != 0) ? $timeout : 30;
}
public function encoding($str)
{
return "=?ks_c_5601-1987?B?" . base64_encode($str) . "?=";
}
private function _mail_env ($to, $from, $subject, $body, $priority = 3, $notification = 0)
{
$this->mail_from = $from;
$this->mail_to = $to;
$this->mail_subject = $subject;
$this->mail_body = $body;
$this->mail_priority = $priority;
$this->mail_notification = $notification;
}
private function _smtp_base_header()
{
$this->_smtp_cmd("From: $this->mail_from");
$this->_smtp_cmd("To: $this->mail_to");
$this->_smtp_cmd("Subject: $this->mail_subject");
$this->_smtp_cmd("MIME-Version: $this->mime_version");
$this->_smtp_cmd("X-Priority: $this->mail_priority");
$this->_smtp_cmd("X-Mailer: $this->mime_xmailer");
}
private function _smtp_base_content()
{
$this->_smtp_cmd("Content-Type: $this->mime_content_type; charset=\"$this->mime_charset\"");
$this->_smtp_cmd("Content-Transfer-Encoding: $this->mime_encoding");
}
private function _smtp_multipart_content($attach = false)
{
if($attach)
{
$this->_smtp_cmd("Content-Type: multipart/mixed; boundary=\"$this->mime_boundary\"");
} else {
$this->_smtp_cmd("Content-Type: multipart/alternative; boundary=\"$this->mime_boundary\"");
}
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd("This is a multi-part message in MIME format.");
}
private function _smtp_attachfile_content()
{
$this->_smtp_cmd("Content-Type: $this->smtp_attachfile_type");
$this->_smtp_cmd("Content-Transfer-Encoding: $this->mime_encoding");
$this->_smtp_cmd("Content-Disposition: attachment; filename=\"$this->smtp_attachfile_name\"");
}
private function _smtp_start_boundary()
{
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd("--$this->mime_boundary");
}
private function _smtp_end_boundary()
{
$this->_smtp_cmd("--$this->mime_boundary--");
}
public function open()
{
$this->smtp_socketopen = @fsockopen($this->smtp_server, $this->smtp_port, $errno, $errstr, $this->smtp_timeout);
if($this->_smtp_code($this->_receive()) != 220)
{
throw new Exception("..... ... . .....");
}
else
{
$this->smtp_status = true;
}
return $this->smtp_status;
}
private function _smtp_helo()
{
$this->_smtp_cmd("HELO $this->smtp_server");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_mailfrom($from)
{
$this->_smtp_cmd("MAIL FROM: $this->mail_from");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_rcptto($to)
{
$this->_smtp_cmd("RCPT TO: $this->mail_to");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_data()
{
$this->_smtp_cmd("DATA");
if($this->_smtp_code($this->_receive()) == 354)
{
return true;
}
return false;
}
private function _smtp_end()
{
$this->_smtp_cmd(".");
if($this->_smtp_code($this->_receive()) == 250)
{
return true;
}
return false;
}
private function _smtp_quit()
{
$this->_smtp_cmd("QUIT");
if($this->_smtp_code($this->_receive()) == 221)
{
return true;
}
return false;
}
public function close()
{
if(@fclose($this->smtp_socketopen) == false)
{
throw new Exception(".. ..... ...... .....");
}
return true;
}
private function _smtp_send($files = null)
{
$this->mime_boundary = "======" . uniqid(rand()) . "/$_SERVER[SERVER_NAME]";
$mail_body = nl2br(stripslashes($this->mail_body));
if($this->mime_encoding == "base64")
{
$mail_body = chunk_split(base64_encode($mail_body));
}
$this->smtp_cmd_status[] = $this->_smtp_helo();
$this->smtp_cmd_status[] = $this->_smtp_mailfrom($this->mail_from);
$this->smtp_cmd_status[] = $this->_smtp_rcptto($this->mail_to);
$this->smtp_cmd_status[] = $this->_smtp_data();
$this->_smtp_base_header();
if(is_array($files))
{
$this->_smtp_multipart_content(true);
$this->_smtp_start_boundary();
$this->_smtp_base_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($mail_body);
$this->_smtp_cmd("$this->smtp_CRLF");
for($i = 0; $i < sizeof($files); $i++)
{
if(is_uploaded_file($files[tmp_name][$i]))
{
$this->smtp_attachfile_name = $this->_check_empty($files[name][$i]);
$this->smtp_attachfile_size = $files[size][$i];
$this->smtp_attachfile_type = $files[type][$i];
$attachfile_handle = @fopen($files[tmp_name][$i], "r");
$attachfile_body = @fread($attachfile_handle, $files[size][$i]);
if($this->mime_encoding == "base64")
{
$attachfile_body = chunk_split(base64_encode($attachfile_body));
}
$this->_smtp_start_boundary();
$this->_smtp_attachfile_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($attachfile_body);
$this->_smtp_cmd("$this->smtp_CRLF");
@fclose($attachfile_handle);
}
}
} else {
$this->_smtp_multipart_content(false);
$this->mime_content_type = "text/plain";
$this->_smtp_start_boundary();
$this->_smtp_base_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($mail_body);
$this->_smtp_cmd("$this->smtp_CRLF");
$this->mime_content_type = "text/html";
$this->_smtp_start_boundary();
$this->_smtp_base_content();
$this->_smtp_cmd("$this->smtp_CRLF");
$this->_smtp_cmd($mail_body);
$this->_smtp_cmd("$this->smtp_CRLF");
}
$this->_smtp_end_boundary();
$this->smtp_cmd_status[] = $this->_smtp_end();
$this->smtp_cmd_status[] = $this->_smtp_quit();
foreach($this->smtp_cmd_status as $key => $value)
{
if($value == false)
{
return false;
break;
}
}
return true;
}
private function _smtp_cmd($str)
{
@fputs($this->smtp_socketopen, $str . $this->smtp_CRLF);
}
private function _smtp_code($str)
{
return substr($str, 0, 3);
}
private function _receive()
{
return @fgets($this->smtp_socketopen, 1024);
}
private function _check_empty($filename)
{
return preg_replace("/ /i", "_", $filename);
}
public function send($to, $from, $subject, $text, $priority = 3, $files = null)
{
$this->set_xmailer($_SERVER[HTTP_USER_AGENT]);
$this->set_content_type("text/html");
$this->set_charset("euc_kr");
$this->set_encoding("base64");
$this->_mail_env($to, $from, $this->encoding($subject), $text, $priority);
if($this->_smtp_send($files) == false)
{
throw new Exception("Error");
}
}
public function __destruct()
{
}
};
?>
@@ -0,0 +1,16 @@
<?php
$server_arr = explode(':',$_SERVER['HTTP_HOST']);
$server_url = $server_arr[0];
//if ($HTTP_COOKIE_VARS[UID] == "")
if ($_COOKIE[UID] == "")
{
$transferURL = "http://$server_url/status/index.html";
printf("<script>
alert('접근 권한 에러! 로그인 하세요');
location.replace('$transferURL');
</script>");
die;
}
?>
@@ -0,0 +1,108 @@
<?php
// 이미 로그인 되어 있으면.. raid_stat.html 로 페이지 이동
$server_arr = explode(':',$_SERVER['HTTP_HOST']);
$server_url = $server_arr[0];
//if ($HTTP_COOKIE_VARS[UID] == "admin")
if ($_COOKIE[UID] == "admin")
{
$transferURL = "http://$server_url/raid_stat.html";
printf("<script>
location.replace('$transferURL');
</script>");
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0025)http://ktics.com/Admin.do -->
<HTML><HEAD><TITLE>LG Uplus Cloud Storage RAID</TITLE>
<META http-equiv=Content-Type content="text/html; charset=ks_c_5601-1987">
<SCRIPT language=javascript src="img/WebCommon.js"></SCRIPT>
<SCRIPT language=javascript src="img/WebLink.js"></SCRIPT>
<SCRIPT>
<!--
function focus()
{
document.loginproc.uid.focus();
}
function checkSubmit(form)
{
if (form.uid.value=='' || isEmpty(form.uid.value)) {
alert('아이디를 정확하게 입력하여 주십시오.');
form.uid.focus();
return false;
}
if (form.upw.value=='') {
alert('비밀번호를 정확하게 입력하여 주십시오.');
form.upw.focus();
return false;
}
if(!CheckID(form.uid.value))
{
alert('ID는 영문이나 숫자의 조합이어야 합니다.');
form.uid.focus();
return false;
}
if(!CheckID(form.upw.value))
{
alert('패스워드는 영문이나 숫자의 조합이어야 합니다.');
form.upw.focus();
return false;
}
if (form.uid.value.length < 4)
{
alert('ID는 4자 이상이어야 합니다.');
form.uid.focus();
return false;
}
form.saveid.value = 1;
form.ssl.value = 0;
}
//-->
</SCRIPT>
<LINK href="로그인.files/Basic.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2900.3086" name=GENERATOR></HEAD>
<BODY onload="focus();">
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" bordre="0">
<TBODY>
<TR>
<TD align=middle>
<TABLE height=340 cellSpacing=0 cellPadding=0 width=625
background=img/BgLogin.gif bordre="0">
<TBODY>
<TR>
<TD width=256 height=77></TD>
<TD></TD></TR>
<TR>
<TD></TD>
<TD vAlign=top>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<FORM name="loginproc" action="inc/login_process.html" method=post onsubmit="return checkSubmit(this);">
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top height=30><INPUT class="Box02 TxtTahoma"
style="WIDTH: 160px; HEIGHT: 22px" name="uid"> </TD></TR>
<TR>
<TD><INPUT class="Box02 TxtTahoma" style="WIDTH: 160px; HEIGHT: 22px" type=password name="upw">
<input type=hidden name=saveid value="">
<input type=hidden name=ssl value="">
</TD></TR></TBODY></TABLE></TD>
<TD
style="PADDING-RIGHT: 0px; PADDING-LEFT: 8px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">
<input type="image" src="img/BtnLogin.gif" width="113" height="52"></TD>
</TR></FORM></TBODY></TABLE></TD></TR>
<TR>
<TD vAlign=bottom align=middle colSpan=2>Copyright 2019 LG Uplus
Corporation. All rights
reserved.</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
@@ -0,0 +1,402 @@
<html>
<head>
<title>######## SYSTEM-HOSTING SERVICE STATUS ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## SYSTEM-HOSTING SERVICE STATUS ########</h3></td>
</tr>
</table>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();">클릭</a>
</td>
</tr>
</table>
<?php
$monitor_member = array("SE ROOM"=>"031-788-0191",
"강명균"=>"016-574-5625",
"최현선(주중야간)"=>"011-365-0370",
"박성우(주중야간)"=>"011-9953-7630",
"김기백(주중주간)"=>"017-608-2385",
"김동민(주말야간)"=>"011-9719-8899",
"김경완"=>"011-9279-1325, 010-2800-1325",
"신동호"=>"017-713-4785",
"박정제"=>"011-9737-1955, 02-805-1955",
"강중권"=>"011-745-4849, 02-868-6378",
"임상현"=>"019-376-1236, 010-3337-1236",
"배상범"=>"010-4613-8795, 010-4631-8795");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "DREAMLINE-1";
/*
$server_addr[1][0] = "127.0.0.1";
$server_addr[1][1] = "30001";
$server_addr[1][2] = "DREAMLINE-2";
*/
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 1024);
$test .= trim($test2);
$j = strlen($test2);
//echo $test2;
if($j < 1024) break;
}
fclose($fp);
}
//echo $test;
$pt = new parsePipe();
$result = $pt->parseIt($test);
$tot_tr = $pt->countIt();
//echo $tot_tr
?>
<td valign=top><table border=1 cellpadding=1 cellspacing=0>
<tr height="35">
<td colspan="9">
<center><b>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status Changed At</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Disk Checked At</font></b></center></td>
<td width="170"><center><b><font color="#000066">Domain</font></b></center></td>
<td width="70"><center><b><font color="#000066">Total Disk</font></b></center></td>
<td width="70"><center><b><font color="#000066">Free</font></b></center></td>
<td width="70"><center><b><font color="#000066">Used</font></b></center></td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
$totalDisk += $result[$j][8];
$freeDisk += $result[$j][9];
$usedDisk += ($result[$j][8] - $result[$j][9]);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $result[$j][5])?></td>
<td align="center">
<?
if ($result[$j][6] == "-") {
echo "-";
} else {
echo date("Y-m-d H:i:s", $result[$j][6]);
}
?></td>
<td align="center"><?=$pt->translateIt($result[$j][7],7)?></td>
<td align="center"><?=$pt->translateIt($result[$j][8],8)?></td>
<td align="center" bgcolor="<?=$pt->translateIt($result[$j][10],100)?>"><?=$pt->translateIt(trim($result[$j][9]), 8)?></td>
<td align="center">
<?
if($result[$j][8] == "-") echo "-";
else if($result[$j][8] == "0") echo "disabled";
else echo $pt->translateIt($result[$j][8]-$result[$j][9], 8);
?>
</td>
</tr>
</span>
<?
}
?>
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
</tr>
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr);
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'UISSD', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
}
?>
@@ -0,0 +1,442 @@
<html>
<head>
<title>######## SYSTEM-HOSTING SERVICE STATUS ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## SYSTEM-HOSTING SERVICE STATUS ########</h3></td>
</tr>
</table>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();">클릭</a>
</td>
</tr>
</table>
<?php
$monitor_member = array("SE ROOM"=>"031-788-0191",
"강명균"=>"016-574-5625",
"최현선(주중야간)"=>"011-365-0370",
"박성우(주중야간)"=>"011-9953-7630",
"김기백(주중주간)"=>"017-608-2385",
"김동민(주말야간)"=>"011-9719-8899",
"김경완"=>"011-9279-1325, 010-2800-1325",
"신동호"=>"017-713-4785",
"박정제"=>"011-9737-1955, 02-805-1955",
"강중권"=>"011-745-4849, 02-868-6378",
"임상현"=>"019-376-1236, 010-3337-1236",
"배상범"=>"010-4613-8795, 010-4631-8795");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "DREAMLINE-1";
/*
$server_addr[1][0] = "127.0.0.1";
$server_addr[1][1] = "30001";
$server_addr[1][2] = "DREAMLINE-2";
*/
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
//echo $test2;
if($j < 1024) break;
}
fclose($fp);
}
echo "<!-- $test -->";
$pt = new parsePipe();
$result = $pt->parseIt($test);
$tot_tr = $pt->countIt();
//echo $tot_tr
?>
<td valign=top><table border=1 cellpadding=1 cellspacing=0>
<tr height="35">
<td colspan="9">
<center><b>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status Changed At</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Disk Checked At</font></b></center></td>
<td width="170"><center><b><font color="#000066">Domain</font></b></center></td>
<td width="70"><center><b><font color="#000066">Total Disk</font></b></center></td>
<td width="70"><center><b><font color="#000066">Free</font></b></center></td>
<td width="70"><center><b><font color="#000066">Used</font></b></center></td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
$chkServiceName = "";
for($j=0; $j<$tot_tr; $j++){
$serviceName_tmp = explode("_",$result[$j][2]);
$serviceName = $serviceName_tmp[0];
$alt_str = "[$j]".
" [SVC NAME] : $serviceName".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],3).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if($chkServiceName ==""){
$chkServiceName = $serviceName;
echo "<!-- 1 -->";
?>
<tr>
<td align="center" colspan="9"><font size=3><b><?=$serviceName?> Service Status</td>
</tr>
<?
}else if($chkServiceName == $serviceName){
//Do nothing, we're still on the same service
echo "<!-- 2 -->";
}else{
//통계 중간 합산 출력 (윗줄까지의 서비스명과 현재줄의 서비스명이 다른 경우
echo "<!-- 3 ".$chkServiceName." , ".$serviceName." -->";
?>
<tr>
<td align="center" colspan="6"><b><?=$chkServiceName?> Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
</tr>
<tr>
<td align="center" colspan="9"><font size=3><b><?=$serviceName?> Service Status</td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
$chkServiceName = $serviceName;
echo "<!-- 4 ".$chkServiceName." , ".$serviceName." -->";
}
$totalDisk += $result[$j][8];
$freeDisk += $result[$j][9];
$usedDisk += ($result[$j][8] - $result[$j][9]);
echo "<!-- ".$pt->translateIt($result[$j][2],3)."TOT ".$pt->translateIt($totalDisk, 9)." FREE ".$pt->translateIt($freeDisk, 9)." -->";
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $result[$j][5])?></td>
<td align="center">
<?
if ($result[$j][6] == "-") {
echo "-";
} else {
echo date("Y-m-d H:i:s", $result[$j][6]);
}
?></td>
<td align="center"><?=$pt->translateIt($result[$j][7],7)?></td>
<td align="center"><?=$pt->translateIt($result[$j][8],8)?></td>
<td align="center" bgcolor="<?=$pt->translateIt($result[$j][10],100)?>"><?=$pt->translateIt(trim($result[$j][9]), 8)?></td>
<td align="center">
<?
if($result[$j][8] == "-") echo "-";
else if($result[$j][8] == "0") echo "disabled";
else echo $pt->translateIt($result[$j][8]-$result[$j][9], 8);
?>
</td>
</tr>
</span>
<?
}
//가장 마지막 서비스 통계 출력
?>
<tr>
<td align="center" colspan="6"><b><?=$chkServiceName?> Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
</tr>
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr);
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'UISSD', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
}
?>
@@ -0,0 +1,513 @@
<?
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING SERVICE STATUS ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## SYSTEM-HOSTING SERVICE STATUS ########</h3></td>
</tr>
</table>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();">클릭</a>
</td>
</tr>
</table>
<?php
$monitor_member = array("SE ROOM"=>"031-788-0191",
"강명균"=>"016-574-5625",
"최현선(주중야간)"=>"011-365-0370",
"박성우(주중야간)"=>"011-9953-7630",
"김기백(주중주간)"=>"017-608-2385",
"김동민(주말야간)"=>"011-9719-8899",
"김경완"=>"011-9279-1325, 010-2800-1325",
"신동호"=>"017-713-4785",
"박정제"=>"011-9737-1955, 02-805-1955",
"강중권"=>"011-745-4849, 02-868-6378",
"배상범"=>"010-4613-8795, 010-4631-8795");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "DREAMLINE-1";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 1024);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=0 cellpadding=0 cellspacing=0>\n";
echo " <tr>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='80' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$PHP_SELF."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
echo $serviceName[$k];
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status Changed At</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Disk Checked At</font></b></center></td>
<td width="170"><center><b><font color="#000066">Domain</font></b></center></td>
<td width="70"><center><b><font color="#000066">Total Disk</font></b></center></td>
<td width="70"><center><b><font color="#000066">Free</font></b></center></td>
<td width="70"><center><b><font color="#000066">Used</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
$totalDisk += $result[$j][8];
$freeDisk += $result[$j][9];
$usedDisk += ($result[$j][8] - $result[$j][9]);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $result[$j][5])?></td>
<td align="center">
<?
if ($result[$j][6] == "-" || $result[$j][6] == "") {
echo "-";
} else {
echo date("Y-m-d H:i:s", $result[$j][6]);
}
?></td>
<td align="center"><?=$pt->translateIt($result[$j][7],7)?></td>
<td align="center"><?=$pt->translateIt($result[$j][8],8)?></td>
<td align="center" bgcolor="<?=$pt->translateIt($result[$j][10],100)?>"><?=$pt->translateIt(trim($result[$j][9]), 8)?></td>
<td align="center">
<?
if($result[$j][8] == "-" || $result[$j][8] == "") echo "-";
else if($result[$j][8] == "0") echo "disabled";
else echo $pt->translateIt($result[$j][8]-$result[$j][9], 8);
?>
</td>
<td>
<?
$raid_res="";
if($pt->translateIt($result[$j][3],3) == "222.122.153.85")
{
$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$raid_res = exec($command);
$raid_str = explode(":",$raid_res);
//echo date("Y-m-d H:i:s", $raid_str[1]);
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=550, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "NO EVENT";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
}
else
{
echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "check err $raid_str[0]";
echo "</a>";
//print_r($raid_str);
}
}
?>
</td>
</tr>
</span>
<?
}
?>
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,420 @@
<?
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING SERVICE STATUS ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## SYSTEM-HOSTING SERVICE STATUS ########</h3></td>
</tr>
</table>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "222.122.152.22";
$server_addr[0][1] = "8787";
$server_addr[0][2] = "qcrts02";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$command = "bin/arcmond_client rts1075.ktsh.co.kr 8787 1";
exec($command, $result);
?>
<td valign=top>
<?
//$res = explode(":", $result[0]);
print_r($result);
exit;
echo " <table border=0 cellpadding=0 cellspacing=0>\n";
echo " <tr>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='80' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$PHP_SELF."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
echo $serviceName[$k];
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="9">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server Name</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status Changed At</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Disk Checked At</font></b></center></td>
<td width="170"><center><b><font color="#000066">Domain</font></b></center></td>
<td width="70"><center><b><font color="#000066">Total Disk</font></b></center></td>
<td width="70"><center><b><font color="#000066">Free</font></b></center></td>
<td width="70"><center><b><font color="#000066">Used</font></b></center></td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
$totalDisk += $result[$j][8];
$freeDisk += $result[$j][9];
$usedDisk += ($result[$j][8] - $result[$j][9]);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $result[$j][5])?></td>
<td align="center">
<?
if ($result[$j][6] == "-" || $result[$j][6] == "") {
echo "-";
} else {
echo date("Y-m-d H:i:s", $result[$j][6]);
}
?></td>
<td align="center"><?=$pt->translateIt($result[$j][7],7)?></td>
<td align="center"><?=$pt->translateIt($result[$j][8],8)?></td>
<td align="center" bgcolor="<?=$pt->translateIt($result[$j][10],100)?>"><?=$pt->translateIt(trim($result[$j][9]), 8)?></td>
<td align="center">
<?
if($result[$j][8] == "-" || $result[$j][8] == "") echo "-";
else if($result[$j][8] == "0") echo "disabled";
else echo $pt->translateIt($result[$j][8]-$result[$j][9], 8);
?>
</td>
</tr>
</span>
<?
}
?>
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
</tr>
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode(":", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,479 @@
<?
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING SERVICE STATUS ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,굴림체'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="JavaScript">
<!--
function changeVisual()
{
fr = document.frm;
if(fr.chk.value == 0) {
fr.chk.value = 1;
info.style.display="block";
} else {
fr.chk.value = 0;
info.style.display="none";
}
}
//-->
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## SYSTEM-HOSTING SERVICE STATUS ########</h3></td>
</tr>
</table>
<table border="0" align="center" width="1050">
<tr>
<td>
<a href="javascript:changeVisual();">클릭</a>
</td>
</tr>
</table>
<?php
$monitor_member = array("SE ROOM"=>"031-788-0191",
"강명균"=>"016-574-5625",
"최현선(주중야간)"=>"011-365-0370",
"박성우(주중야간)"=>"011-9953-7630",
"김기백(주중주간)"=>"017-608-2385",
"김동민(주말야간)"=>"011-9719-8899",
"김경완"=>"011-9279-1325, 010-2800-1325",
"신동호"=>"017-713-4785",
"박정제"=>"011-9737-1955, 02-805-1955",
"강중권"=>"011-745-4849, 02-868-6378",
"배상범"=>"010-4613-8795, 010-4631-8795");
?>
<div id="info" style="DISPLAY:none;">
<table border="1" cellspacing="1" width="530" align="center">
<tr align="center">
<td><b> Priority </b></td>
<td><b> Name </b></td>
<td><b> Emergency Phone NO. </b> </td>
</tr>
<?
$i = 0;
while(list($key, $value) = each($monitor_member))
{
$i++;
echo"<tr align=\"center\" align=\"center\">\n";
echo" <td><b> ".$i.". </b></td>\n";
echo" <td><b> ".$key." </b></td>\n";
echo" <td><b> ".$value." </b></td>\n";
echo"</tr>\n";
}
?>
</table>
</div>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "DREAMLINE-1";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 1024);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
echo $test;
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=0 cellpadding=0 cellspacing=0>\n";
echo " <tr>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='80' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$PHP_SELF."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
echo $serviceName[$k];
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="9">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status Changed At</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Disk Checked At</font></b></center></td>
<td width="170"><center><b><font color="#000066">Domain</font></b></center></td>
<td width="70"><center><b><font color="#000066">Total Disk</font></b></center></td>
<td width="70"><center><b><font color="#000066">Free</font></b></center></td>
<td width="70"><center><b><font color="#000066">Used</font></b></center></td>
</tr>
<?
$totalDisk = 0;
$freeDisk = 0;
$usedDisk = 0;
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
$totalDisk += $result[$j][8];
$freeDisk += $result[$j][9];
$usedDisk += ($result[$j][8] - $result[$j][9]);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $result[$j][5])?></td>
<td align="center">
<?
if ($result[$j][6] == "-" || $result[$j][6] == "") {
echo "-";
} else {
echo date("Y-m-d H:i:s", $result[$j][6]);
}
?></td>
<td align="center"><?=$pt->translateIt($result[$j][7],7)?></td>
<td align="center"><?=$pt->translateIt($result[$j][8],8)?></td>
<td align="center" bgcolor="<?=$pt->translateIt($result[$j][10],100)?>"><?=$pt->translateIt(trim($result[$j][9]), 8)?></td>
<td align="center">
<?
if($result[$j][8] == "-" || $result[$j][8] == "") echo "-";
else if($result[$j][8] == "0") echo "disabled";
else echo $pt->translateIt($result[$j][8]-$result[$j][9], 8);
?>
</td>
</tr>
</span>
<?
}
?>
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
</tr>
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'UISSD', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$cnt = 0;
$return_str = "";
//$tmp_str = str_replace("\r\n", "", $tmp_str);
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
$splitStr = substr($tmp_str, $i, 1);
if(ord($splitStr) != 0) {
/*if($splitStr == "|") {
$cnt++;
}*/
$return_str .= substr($tmp_str, $i, 1);
//If(($cnt % 10) == 0) $return_str .= "\r\n";
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,133 @@
<script language="JavaScript">
<!--
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v4.01
//Copyright 1998 Macromedia, Inc. All rights reserved.
var i,j,aLayer,retVal,curDrag=null,curLeft,curTop,IE=document.all,NS4=document.layers;
var NS6=(!IE&&document.getElementById), NS=(NS4||NS6); if (!IE && !NS) return false;
retVal = true; if(IE && event) event.returnValue = true;
if (MM_dragLayer.arguments.length > 1) {
curDrag = MM_findObj(objName); if (!curDrag) return false;
if (!document.allLayers) { document.allLayers = new Array();
with (document) if (NS4) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
} else {
if (NS6) { var spns = getElementsByTagName("span"); var all = getElementsByTagName("div");
for (i=0;i<spns.length;i++) if (spns[i].style&&spns[i].style.position) allLayers[allLayers.length]=spns[i];}
for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i];
} }
curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
curDrag.MM_oldZ = (NS4)?curDrag.zIndex:curDrag.style.zIndex;
curLeft= (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
if (String(curLeft)=="NaN") curLeft=0; curDrag.MM_startL = curLeft;
curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
if (String(curTop)=="NaN") curTop=0; curDrag.MM_startT = curTop;
curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop-cU;
curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop+cD;
curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
} else {
var theEvent = ((NS)?objName.type:event.type);
if (theEvent == 'mousedown') {
var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
var maxDragZ=null; document.MM_maxZ = 0;
for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
var aLayerZ = (NS4)?aLayer.zIndex:parseInt(aLayer.style.zIndex);
if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
var isVisible = (((NS4)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
var parentL=0; var parentT=0;
if (NS6) { parentLayer = aLayer.parentNode;
while (parentLayer != null && parentLayer.style.position) {
parentL += parseInt(parentLayer.offsetLeft); parentT += parseInt(parentLayer.offsetTop);
parentLayer = parentLayer.parentNode;
} } else if (IE) { parentLayer = aLayer.parentElement;
while (parentLayer != null && parentLayer.style.position) {
parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
parentLayer = parentLayer.parentElement; } }
var tmpX=mouseX-(((NS4)?pageX:((NS6)?parseInt(style.left):style.pixelLeft)+parentL)+MM_hLeft);
var tmpY=mouseY-(((NS4)?pageY:((NS6)?parseInt(style.top):style.pixelTop) +parentT)+MM_hTop);
if (String(tmpX)=="NaN") tmpX=0; if (String(tmpY)=="NaN") tmpY=0;
var tmpW = MM_hWidth; if (tmpW <= 0) tmpW += ((NS4)?clip.width :offsetWidth);
var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS4)?clip.height:offsetHeight);
if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
|| maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
if (curDrag) {
document.onmousemove = MM_dragLayer; if (NS4) document.captureEvents(Event.MOUSEMOVE);
curLeft = (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
if (String(curLeft)=="NaN") curLeft=0; if (String(curTop)=="NaN") curTop=0;
MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
document.MM_curDrag = curDrag; curDrag.MM_SNAPPED=false;
if(curDrag.MM_toFront) {
eval('curDrag.'+((NS4)?'':'style.')+'zIndex=document.MM_maxZ+1');
if (!curDrag.MM_dropBack) document.MM_maxZ++; }
retVal = false; if(!NS4&&!NS6) event.returnValue = false;
} } else if (theEvent == 'mousemove') {
if (document.MM_curDrag) with (document.MM_curDrag) {
var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
newLeft = mouseX-MM_oldX; newTop = mouseY-MM_oldY;
if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
if (MM_bT!=null) newTop = Math.max(newTop ,MM_bT);
if (MM_bB!=null) newTop = Math.min(newTop ,MM_bB);
MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
if (NS4) {left = newLeft; top = newTop;}
else if (NS6){style.left = newLeft; style.top = newTop;}
else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
if (MM_dragJS) eval(MM_dragJS);
retVal = false; if(!NS) event.returnValue = false;
} } else if (theEvent == 'mouseup') {
document.onmousemove = null;
if (NS) document.releaseEvents(Event.MOUSEMOVE);
if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
if (document.MM_curDrag) with (document.MM_curDrag) {
if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
(Math.pow(MM_targL-((NS4)?left:(NS6)?parseInt(style.left):style.pixelLeft),2)+
Math.pow(MM_targT-((NS4)?top:(NS6)?parseInt(style.top):style.pixelTop),2))<=MM_tol) {
if (NS4) {left = MM_targL; top = MM_targT;}
else if (NS6) {style.left = MM_targL; style.top = MM_targT;}
else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
if(MM_dropBack) {if (NS4) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
retVal = false; if(!NS) event.returnValue = false; }
document.MM_curDrag = null;
}
if (NS) document.routeEvent(objName);
} return retVal;
}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
@@ -0,0 +1,148 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
$group_seq = isset($_GET['group']) ? $_GET['group'] : $_POST['group'];
$member_cellphone = isset($_GET['cell']) ? $_GET['cell'] : $_POST['member_cellphone'];
if($member_cellphone != "" && $group_seq != "")
{
$objConn = new DB_Sql;
$enCoding = "set client_encoding = 'uhc'";
$objConn->query($enCoding);
if(getenv("REQUEST_METHOD") == "GET")
{
$strSql = "SELECT member_name, member_cellphone ";
$strSql .= "FROM t_group_member ";
$strSql .= "WHERE group_seq = ".$group_seq." AND member_cellphone = '".$member_cellphone."'";
$objConn->query($strSql);
if($objConn->nf() == 1)
{
$objConn->next_record();
$member_name = $objConn->f("member_name");
$member_cellphone = $objConn->f("member_cellphone");
}else
{
echo "<script language='javascript'>\n";
echo " alert('잘못된 접근입니다..');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
?>
<html>
<head>
<title></title>
<script language='javascript'>
function chkForm()
{
frm = document.info;
if(frm.member_name.value == '')
{
alert('이름을 입력하세요!');
return;
}
if(frm.member_cellphone.value == "")
{
alert('핸드폰번호를 입력하세요!');
return;
}
frm.actiontype.value = 1;
frm.submit();
}
function delForm()
{
frm = document.info;
if(confirm('정말 삭제 하겠습니까?'))
{
frm.actiontype.value = 0;
frm.member_cellphone.value = '<?= $member_cellphone ?>';
frm.submit();
}
}
</script>
</head>
<body>
<form name='info' method='POST' action='./mod_member.html'>
<table>
<tr>
<td>&nbsp;이름</td>
<td><input name='member_name' maxlength='20' value='<?= $member_name ?>'></td>
</tr>
<tr>
<td>&nbsp;핸드폰</td>
<td><input name='member_cellphone' maxlength='15' value='<?= $member_cellphone ?>'></td>
</tr>
<tr>
<td colspan='2'>
<input type='hidden' name='group' value='<?= $group_seq ?>'>
<input type='hidden' name='actiontype'>
<input type='hidden' name='org_member_cellphone' value='<?= $member_cellphone ?>'>
<div align='right'><a href='javascript:history.back(-1)'>뒤로</a>&nbsp;<a href='javascript:delForm()'>삭제</a>&nbsp;<a href='javascript:chkForm();'>수정</a></div>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
}else if(getenv("REQUEST_METHOD") == "POST")
{
$action_type = trim($_POST['actiontype']);
$group_seq = trim($_POST['group']);
$member_name = trim($_POST['member_name']);
$member_cellphone = trim(str_replace("-", "", $_POST['member_cellphone']));
$org_member_cellphone = trim(str_replace("-", "", $_POST['org_member_cellphone']));
$strSql = "SELECT COUNT(group_seq) AS cnt ";
$strSql .= "FROM t_group_member ";
$strSql .= "WHERE group_seq = ".$group_seq." AND member_cellphone = '".$org_member_cellphone."'";
$objConn->query($strSql);
if($objConn->nf() != 0)
{
$objConn->next_record();
$cnt = $objConn->f("cnt");
if($cnt == 1)
{
if($action_type == 0) //삭제
{
$strSql = "DELETE FROM t_group_member ";
$strSql .= "WHERE group_seq = ".$group_seq." AND member_cellphone = '".$org_member_cellphone."'";
}else if($action_type == 1) //수정
{
$strSql = "UPDATE t_group_member ";
$strSql .= "SET member_name ='".$member_name."', ";
$strSql .= " member_cellphone ='".$member_cellphone."', ";
$strSql .= " update_datetime = now() ";
$strSql .= "WHERE group_seq = ".$group_seq." AND member_cellphone = '".$org_member_cellphone."'";
}
$objConn->query($strSql);
echo "<script language='javascript'>\n";
if($action_type == 0)
{
echo " alert('삭제되었습니다.');\n";
}else if($action_type == 1)
{
echo " alert('수정되었습니다.');\n";
}
echo " location.href = './group_list.html';\n";
echo "</script>";
}
}
}
}else
{
echo "<script language='javascript'>\n";
echo " alert('잘못된 접근입니다..');\n";
echo " history.back(-1);\n";
echo "</script>";
die;
}
?>
@@ -0,0 +1,32 @@
<?php
//define(DBTYPE, "MYSQL");
define(DBTYPE, "ORACLE");
if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
function sendsms_mysql()
{
echo "mysql";
}
function sendsms_oracle()
{
echo "oracle";
}
if( DBTYPE == "MYSQL" )
sendsms_mysql();
else if( DBTYPE == "ORACLE")
sendsms_oracle();
?>
@@ -0,0 +1,155 @@
<?php
// include what we needs
//require_once ("../inc/pgsql.inc");
//require_once ("../inc//oci8inc.php");
//require_once ("../inc/sendmail.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function SMSserver($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
//$id = $_GET['id'];
//$pw = $_GET['pw'];
$rcid = "ALL";
$pw = "1234";
$msg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
$host = $_GET['host'];
$msg = "[RAID:".$host."]:".$time.":".$msg;
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
//exit;
//system("$cmd >> raid.send.sms.mail.`date +%Y%m%d`.log");
//system("$cmd >> test.log");
echo $msg;
$to_mails = "svc1@solbox.com";
$from_mail = "svc1@solbox.com";
################ FIXME:TEST VALUE #######################
//$raddr = "61.111.52.21";
//$to_mails = "tael@solbox.com, huibong@solbox.com";
//$from_mail = "tael@solbox.com";
#########################################################
$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($rcid != "" && $msg != "")
{
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$rcid."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if(SMSserver( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $rcid )){ // send sms success !!
$SMS_send_Success = true;
break;
}
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "rcid or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. rcid : \"$rcid\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
@@ -0,0 +1,152 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
// CHG 2011-03-22 huibong 메일 전송 계정을 svc1 로 변경처리함.
//$from_mail = "nuhonda@solbox.com";
$from_mail = "svc1@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect('222.122.18.22', 'smsuser', 'sms5emffld)', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,241 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = "RAID";
$pw = "1234";
$to_mails = "infra.storage@solbox.com";
$from_mail = "storage@solbox.com";
// For LG
define(DB_HOST, "smsdb.x-cdn.com");
define(DB_USER, "xcdnuser");
define(DB_PWD, "solbox123");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'SMS', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$tmpSqlmy = "INSERT INTO SC_TRAN( TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE ) ";
$tmpSqlmy .= "VALUES ( now(), '0', '$cellphone', '0220862690', '$msg', '0'); ";
//echo "mysql query : " . $tmpSqlmy; echo" <br><br>";
$res=$dbConnMySql->query($tmpSqlmy, __FILE__, __LINE__);
if(!$res->result)
{
echo "fail to send SMS "; echo "<br><br>";
makelog(false, $tmpSqlmy);
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'RAID', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message ¿¡¼­ ±¸ºÐÀÚ : À» Á¦°Åó¸®
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
//echo "Message : $msg Size :$sizelen Query: $strSqlpg \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,96 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
echo $msg;
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
$from_mail = "nuhonda@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
//$dbConnMySql = new dbconnect('211.39.134.240', 'ktsh', 'ktsh!@#', 'sms', __FILE__, __LINE__);
$dbConnMySql = new dbconnect('211.39.134.240', 'sms', '', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 ) ";
//$tmpSqlmy .= "VALUES ( '$cellphone', '', sysdate(), '$msg', '$cli_ip')";
$tmpSqlmy .= "VALUES ( '$cellphone', '$cellphone', sysdate(), '$msg', '$cli_ip')";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,108 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// 2010-06-17 Message format modify by huibong
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
$from_mail = "nuhonda@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
// 2010-06-17 huibong clear year field from time format.
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
//$dbConnMySql = new dbconnect('211.39.134.240', 'ktsh', 'ktsh!@#', 'sms', __FILE__, __LINE__);
$dbConnMySql = new dbconnect('211.39.134.240', 'sms', '', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 ) ";
//$tmpSqlmy .= "VALUES ( '$cellphone', '', sysdate(), '$msg', '$cli_ip')";
$tmpSqlmy .= "VALUES ( '$cellphone', '$cellphone', sysdate(), '$msg', '$cli_ip')";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,128 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
$from_mail = "nuhonda@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
//$dbConnMySql = new dbconnect('211.39.134.240', 'ktsh', 'ktsh!@#', 'sms', __FILE__, __LINE__);
$dbConnMySql = new dbconnect('211.39.134.240', 'sms', '', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 ) ";
//$tmpSqlmy .= "VALUES ( '$cellphone', '', sysdate(), '$msg', '$cli_ip')";
$tmpSqlmy .= "VALUES ( '$cellphone', '$cellphone', sysdate(), '$msg', '$cli_ip')";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,149 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
$from_mail = "nuhonda@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect('222.122.18.22', 'smsuser', 'sms5emffld)', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,152 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
// CHG 2011-03-22 huibong 메일 전송 계정을 svc1 로 변경처리함.
//$from_mail = "nuhonda@solbox.com";
$from_mail = "svc1@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect('222.122.18.22', 'smsuser', 'sms5emffld)', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,247 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
//$id = "BD-RC004"; // test
$id = "ALL";
$pw = "1234";
$to_mails = "sh_raid@solbox.com"; // or
$from_mail = "storage.sd@solbox.com";
define(DB_HOST, "222.122.18.22");
define(DB_USER, "smsuser");
define(DB_PWD, "sms5emffld)");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
echo $tmpSqlpg."<br>";
echo $tmpSqlmy."<br>";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
return false;
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
#$strSqlpg .= "WHERE group_id = '".$id."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,247 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
//$id = "BD-RC004"; // test
$id = "ALL";
$pw = "1234";
$to_mails = "sh_raid@solbox.com"; // or
$from_mail = "storage.sd@solbox.com";
define(DB_HOST, "222.122.18.22");
define(DB_USER, "smsuser");
define(DB_PWD, "sms5emffld)");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
echo $tmpSqlpg."<br>";
echo $tmpSqlmy."<br>";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
return false;
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
#$strSqlpg .= "WHERE group_id = '".$id."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,242 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = "ALL";
$pw = "1234";
$to_mails = "sh_raid@solbox.com"; // or
$from_mail = "storage.sd@solbox.com";
// For SKBB
define(DB_HOST, "sms.myskcdn.co.kr:13306");
define(DB_USER, "sms");
define(DB_PWD, "solbox@#12");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$tmpSqlmy = "INSERT INTO sms.T_SMS_SD( SERVICE_CODE, CALLEE_NO, CALLBACK_NO, CALLBACK_URL, SMS_MSG, SAVE_TIME, SEND_TIME ) ";
$tmpSqlmy .= "VALUES ( 'SOLBOX-CS', '$cellphone', '0221823688', '', '$msg', substr(cast(now() as char),1,16), substr(cast(now() as char),1,16) ); ";
//echo "mysql query : " . $tmpSqlmy; echo" <br><br>";
$res=$dbConnMySql->query($tmpSqlmy, __FILE__, __LINE__);
if(!$res->result)
{
echo "fail to send SMS "; echo "<br><br>";
makelog(false, $tmpSqlmy);
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
#$strSqlpg .= "WHERE group_id = '".$id."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,250 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = "BD-RC004"; // test
//$id = "ALL";
$pw = "1234";
//$to_mails = "sh_raid@solbox.com"; // or
$to_mails = "webting@solbox.com"; // or
//$to_mails = "svc1@solbox.com";
$from_mail = "svc1@solbox.com";
define(DB_HOST, "222.122.18.22");
define(DB_USER, "smsuser");
define(DB_PWD, "sms5emffld)");
//$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
echo $tmpSqlpg."<br>";
echo $tmpSqlmy."<br>";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
return false;
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
#$strSqlpg .= "WHERE group_id = '".$id."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,162 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "BD-RC004"; // test
//$id = "ALL";
$pw = "1234";
////$to_mails = "sh_raid@solbox.com"; // or
//$to_mails = "webting@solbox.com"; // or
////$to_mails = "svc1@solbox.com";
//$from_mail = "svc1@solbox.com";
//
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "webting@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
// CHG 2011-03-22 huibong 메일 전송 계정을 svc1 로 변경처리함.
//$from_mail = "nuhonda@solbox.com";
$from_mail = "svc1@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect('222.122.18.22', 'smsuser', 'sms5emffld)', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
echo $tmpSqlpg."<br>";
echo $tmpSqlmy."<br>";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,97 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "0udisk";
$pw = "alfkzmf!?{}";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$to_mails = "redeye@solutionbox.co.kr,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,gopss@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr";
$from_mail = "mirshead@netomi.co.kr";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $pw != "" && $msg != "")
{
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//$strSqlpg .= " AND member_cellphone='0117454849'";
//$strSqlpg .= "LIMIT 1 ";
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
//echo "1"."<br>";
$dbConnMySql = new dbconnect('211.39.134.240', 'ktsh', 'ktsh!@#', 'sms', __FILE__, __LINE__);
//echo "2";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$tmpSqlmy = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 ) ";
$tmpSqlmy .= "VALUES ( '$cellphone', '', sysdate(), '$msg', 'ktsh')";
//echo "$tmpSqlmy";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
//echo "3";
}
}
}
?>
@@ -0,0 +1,97 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "0udisk";
$pw = "alfkzmf!?{}";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$to_mails = "dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,hnanna@kt.co.kr,frogs@kt.co.kr,tukim99@kt.co.kr,gopss@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr";
$from_mail = "mirshead@netomi.co.kr";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $pw != "" && $msg != "")
{
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//$strSqlpg .= " AND member_cellphone='0117454849'";
//$strSqlpg .= "LIMIT 1 ";
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
//echo "1"."<br>";
$dbConnMySql = new dbconnect('211.39.134.109', 'sh_trans', 'sh_trans', 'midc', __FILE__, __LINE__);
//echo "2";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$tmpSqlmy = "INSERT INTO sms(id, dstaddr, msg, deliver) ";
$tmpSqlmy .= "VALUES ('SH_".$id."', '".$cellphone."', '".$msg."', 9)";
//echo "$tmpSqlmy";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
//echo "3";
}
}
}
?>
@@ -0,0 +1,128 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
$from_mail = "nuhonda@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
//$dbConnMySql = new dbconnect('211.39.134.240', 'ktsh', 'ktsh!@#', 'sms', __FILE__, __LINE__);
$dbConnMySql = new dbconnect('211.39.134.240', 'sms', '', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 ) ";
//$tmpSqlmy .= "VALUES ( '$cellphone', '', sysdate(), '$msg', '$cli_ip')";
$tmpSqlmy .= "VALUES ( '$cellphone', '$cellphone', sysdate(), '$msg', '$cli_ip')";
$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,249 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = "BD-RC004"; // test
//$id = "ALL";
$pw = "1234";
//$to_mails = "sh_raid@solbox.com"; // or
$to_mails = "webting@solbox.com"; // or
//$to_mails = "svc1@solbox.com";
$from_mail = "svc1@solbox.com";
define(DB_HOST, "222.122.18.22");
define(DB_USER, "smsuser");
define(DB_PWD, "sms5emffld)");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
echo $tmpSqlpg."<br>";
echo $tmpSqlmy."<br>";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
return false;
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
#$strSqlpg .= "WHERE group_id = '".$id."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,250 @@
<?php
define(DBTYPE, "MYSQL"); // or
//define(DBTYPE, "ORACLE");
if( DBTYPE == "ORACLE" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oci8inc.php");
else if( DBTYPE == "MYSQL" )
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = "BD-RC004"; // test
//$id = "ALL";
$pw = "1234";
$to_mails = "trozan@solbox.com"; // or
//$to_mails = "sh_raid@solbox.com"; // or
//$to_mails = "webting@solbox.com"; // or
//$to_mails = "svc1@solbox.com";
$from_mail = "sd@solbox.com";
define(DB_HOST, "222.122.18.22");
define(DB_USER, "smsuser");
define(DB_PWD, "sms5emffld)");
function cutstr($str,$size) {
if(!$size or (strlen($str) <= $size)) return $str;
else for($i = 0;$i < $size;$i++) if(ord($str[$i]) > 127) $over++;
return chop(substr($str,0,$size - $over%2));
}
function sendsms_mysql($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid )
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect(DB_HOST, DB_USER , DB_PWD, 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
echo $tmpSqlpg."<br>";
echo $tmpSqlmy."<br>";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
return false;
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
return true;
}
function sendsms_oracle($msg,$dbConnPgSql,$strSqlpg,$group_seq, $sid)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 0)
{
echo "fail to pgsql querty : $strSqlpg "; echo "<br><br>";
return false;
}
$dbConnOra = new Oracle_OCI_log;
$dbConnOra->connect("xcdnuser", "solbox123", "SMS");
$dbConnOra->connect($DB_HOST, $DB_USER, "SMS");
if( !$dbConnOra->conn ) {
echo "Oracle Connect Failed "; echo "<br><br>";
}
echo " Oracle DB SERVER Connecting..."; echo "<br><br>";
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
$cli_ip = $_SERVER['REMOTE_ADDR'];
$tmpSqlmy = "INSERT INTO SC_TRAN(TR_NUM, TR_SENDDATE, TR_SENDSTAT, TR_PHONE, TR_CALLBACK, TR_MSG, TR_MSGTYPE)";
$tmpSqlmy .= "VALUES ( SC_SEQUENCE.NEXTVAL, SYSDATE, '0', '$cellphone', '$cellphone', '$msg', '0')";
$dbConnOra->parseExec($tmpSqlmy);
if($dbConnOra->error) {
echo "fail to send SMS "; echo "<br><br>";
continue;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$sid."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$dbConnOra->disconnect();
if($user_count == $dbConnPgSql->nf()){
echo "Success to All send SMS " ; echo "<br><br>";
$dbConnPgSql->query($tmpSqlpg);
return true;
}
return false;
}
$mseg = $_GET['msg'];
$time = $_GET['time'];
$raddr = $_SERVER["REMOTE_ADDR"];
echo $mseg."<br>";
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$cmd = 'echo `date +"%Y%m%d %H:%M:%S"`'.": $host";
system("$cmd >> logs/raid.send.sms.mail.`date +%Y%m%d`.log");
$body = trim(htmlBody($raddr));
#$body = trim(MakeHtmlBodyFromArcmondClient($raddr, 8787, 2)); // default value of arcmond
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++) {
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
$sms_host = strtok( $_GET['host'], "." );
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
//$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
$msg = "[RAID:".$sms_host."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
#$strSqlpg .= "WHERE group_id = '".$id."' AND deleted_yn = 'N'";
$sizelen=strlen($msg);
echo "Message : $msg Size :$sizelen \n"; echo "<br><br>";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
if($sizelen > 80){
$strtmp = $msg;
$msg=cutstr($strtmp,80);
$sizelen=strlen($msg);
echo "CutSTR Message : $msg Size :$sizelen \n"; echo "<br><br>";
}
$SMS_send_Success = false;
for($i = 0; $i< 2; $i++) {
if(!$SMS_send_Success) {
if( DBTYPE == "MYSQL" )
$SMS_send_Success = sendsms_mysql( $msg, $dbConnPgSql, $strSqlpg, $group_seq, $id);
else if( DBTYPE == "ORACLE")
$SMS_send_Success = sendsms_oracle();
if( $SMS_send_Success ) break;
}
}
if(!$SMS_send_Success ){
echo "Unexpected error was occured "; echo "<br><br>";
}
}else
echo "PGSQL `group_seq` failed"; echo "<br><br>";
$dbConnPgSql->close();
}else
echo "id or msg NULL!!!"; echo "<br><br>";
}else
echo "Unexpected error was occured. id : \"$id\" msg :\"$msg\"\n"; echo "<br><br>";
exit;
?>
@@ -0,0 +1,152 @@
<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sendmail.inc");
$id = $_GET['id'];
$pw = $_GET['pw'];
$mseg = $_GET['msg'];
$time = $_GET['time'];
$id = "ALL";
$pw = "1234";
$raddr = $_SERVER["REMOTE_ADDR"];
/*
$command = "../bin/arcmond_client ".$raddr." 8787 1";
sleep(2);
$raid_res = exec($command);
$raid_str = explode(":", $raid_res);
$last_num = count($raid_str) - 1;
if($raid_str[0] == "0") {
$strTmp = "No event";
} else if($raid_str[0] == "1") {
$strTmp = $raid_str[$last_num];
} else {
$strTmp = "check err $raid_str[2]$raid_str[3]";
}
*/
// CHG 2010-06-17 huibong Message 에서 구분자 : 을 제거처리
//$msg = "[RAID:".$_GET['host']."]::".$time.":".$mseg;
$msg = "[RAID:".$_GET['host']."] ".$time." ".$mseg;
echo $msg."<br>";
$to_mails = "sh_raid@solbox.com";
####$to_mails = "linuxser@solbox.com,dev@netomi.co.kr,bs@netomi.co.kr,lyj94@netomi.co.kr,2020kid@netomi.co.kr,redeye@netomi.co.kr,ssantacho@netomi.co.kr,hnanna@kt.co.kr,tukim99@kt.co.kr,dgkim06@kt.co.kr,leehj@kt.co.kr,js4c@netomi.co.kr,waiting@netomi.co.kr";
// CHG 2011-03-22 huibong 메일 전송 계정을 svc1 로 변경처리함.
//$from_mail = "nuhonda@solbox.com";
$from_mail = "svc1@solbox.com";
$body = trim(htmlBody($raddr));
$to_mail = explode(",", $to_mails);
$cnt = count($to_mail);
for($i=0; $i < $cnt; $i++)
{
$sendmail = new sendmail("127.0.0.1", 25, 30);
$sendmail->open();
$sendmail->send($to_mail[$i], $from_mail, trim($msg), $body);
$sendmail->close();
}
if($id != "" && $msg != "")
{
//$msg = "[RAID:".$_GET['host']."] ".$sms_time." ".$mseg;
// NEW 2010-06-18 huibong RAID SMS 가 다음과 같은 형식으로 처리되도록 수정처리함.
// [RAID:ics15-qcfhs1 222.122.162.111] 07-16 10:28:41 #1 IDE Channel #16 Device Removed
// 1. host 부분에서 ktsh.co.kr 제거처리
$sms_host = strtok( $_GET['host'], "." );
// 2. 시간 정보 중 년도 부분을 제거처리
$sms_time = $time;
if( strlen($sms_time) > 14 )
{
$sms_time = substr($time, 5);
}
// 3. 메시지 중 Controller#1 부분을 #1 으로 변경처리
$sms_msg = $mseg;
if( strncmp( $mseg, "Controller#", 11) == 0 )
{
$sms_msg = substr( $mseg, 10 );
}
// 4. 최종 SMS 메시지 조립 (IP 정보 부분 추가 처리)
$msg = "[RAID:".$sms_host." ".$raddr."] ".$sms_time." ".$sms_msg;
echo $msg."<br>";
exit;
$dbConnPgSql = new DB_Sql;
$strSqlpg = "SELECT group_seq ";
$strSqlpg .= "FROM t_group ";
$strSqlpg .= "WHERE group_id = '".$id."' AND group_password = '".$pw."' AND deleted_yn = 'N'";
$dbConnPgSql->query($strSqlpg);
if($dbConnPgSql->nf() == 1)
{
$dbConnPgSql->next_record();
$group_seq = $dbConnPgSql->f("group_seq");
if($group_seq != "")
{
$strSqlpg = "SELECT member_cellphone ";
$strSqlpg .= "FROM t_group_member ";
$strSqlpg .= "WHERE group_seq = ".$group_seq;
//echo $strSqlpg."<br>";
$dbConnPgSql->query($strSqlpg);
//echo $dbConnPgSql->nf()."<br>";
if($dbConnPgSql->nf() != 0)
{
$tmpSqlmy = "";
$tmpSqlpg = "";
$user_count =0;
$cellphone_list = "";
// 2010-09-15 huibong SMS RELAY 서버 변경 및 관련 코드 수정 처리함.
$dbConnMySql = new dbconnect('222.122.18.22', 'smsuser', 'sms5emffld)', 'sms', __FILE__, __LINE__);
while($dbConnPgSql->next_record())
{
$cellphone = $dbConnPgSql->f("member_cellphone");
if( strlen($cellphone_list) > 0 )
{
$cellphone_list .= "|ktics1^" . $cellphone;
}
else
{
$cellphone_list = "ktics1^" . $cellphone;
}
$user_count ++;
$tmpSqlpg .= "INSERT INTO t_sms_log (group_seq, sms_id, sms_cellphone, sms_message, reg_datetime, update_datetime) ";
$tmpSqlpg .= "VALUES (".$group_seq.", 'SH_".$id."', '".$cellphone."', '".$msg."', now(), now()); ";
}
$tmpSqlmy = "INSERT INTO SDK_SMS_SEND ( USER_ID, SCHEDULE_TYPE, SUBJECT, NOW_DATE,SEND_DATE, CALLBACK, DEST_COUNT, DEST_INFO, SMS_MSG) ";
$tmpSqlmy .= "VALUES ('ktics1', 0,'ktics1',DATE_FORMAT(now(),'%Y%m%d%H%i%s'),DATE_FORMAT(now(),'%Y%m%d%H%i%s'),'0317810344',$user_count,'$cellphone_list','$msg')";
$res = $dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
if( !$res->result )
{
echo "fail to send SMS "; echo "<br><br>";
}
$dbConnMySql->close();
$dbConnPgSql->query($tmpSqlpg);
}
}
}
}
?>
@@ -0,0 +1,458 @@
<?php
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<meta charset="euc-kr">
<title>Cloud Storage RAID Status</title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>Cloud Storage RAID Status</h3></td>
</tr>
</table>
<?php
require_once ("/user/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "X-CDN";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++)
{
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$_SERVER['PHP_SELF']."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k])
{
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
//$mode = "I'M YOUR FATHER. BASTARD !";
//$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$mode = "EVENT:INFO:ONE";
//$command = 'bin/raidmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
$command = 'bin/arcmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
//echo $command;
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
#echo "NO EVENT";
echo "$raid_str[$last_num]";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$$_SERVER['PHP_SELF']?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,458 @@
<?php
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<meta charset="euc-kr">
<title>Cloud Storage RAID Status</title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>Cloud Storage RAID Status</h3></td>
</tr>
</table>
<?php
require_once ("/user/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "SKB";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++)
{
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$_SERVER['PHP_SELF']."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k])
{
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
//$mode = "I'M YOUR FATHER. BASTARD !";
//$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$mode = "EVENT:INFO:ONE";
//$command = 'bin/raidmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
$command = 'bin/arcmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
//echo $command;
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
#echo "NO EVENT";
echo "$raid_str[$last_num]";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$$_SERVER['PHP_SELF']?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,459 @@
<?php
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
header("Content-type: text/html; charset=euc-kr");
?>
<html>
<head>
<title>Cloud Storage RAID Status</title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>Cloud Storage RAID Status</h3></td>
</tr>
</table>
<?php
require_once ("/user/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "127.0.0.1";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "KT-IDC";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++)
{
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$_SERVER['PHP_SELF']."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k])
{
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
//$mode = "I'M YOUR FATHER. BASTARD !";
//$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$mode = "EVENT:INFO:ONE";
//$command = 'bin/raidmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
$command = 'bin/arcmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
//echo $command;
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
#echo "NO EVENT";
echo "$raid_str[$last_num]";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$$_SERVER['PHP_SELF']?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,443 @@
<?
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING RAID STATUS PANNEL ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## ICS SERVICE STATUS ########</h3></td>
</tr>
</table>
<?php
require_once ("/user2/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "222.122.136.110";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "KT-IDC";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$PHP_SELF."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k]){
case 'INCOK' : echo "TRINEX"; break;
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "NO EVENT";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,443 @@
<?
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING RAID STATUS PANNEL ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## ICS SERVICE STATUS ########</h3></td>
</tr>
</table>
<?php
require_once ("/user2/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "222.122.136.110";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "KT-IDC";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$PHP_SELF."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k]){
case 'INCOK' : echo "TRINEX"; break;
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "NO EVENT";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,449 @@
<?
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING RAID STATUS PANNEL ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## ICS SERVICE STATUS ########</h3></td>
</tr>
</table>
<?php
require_once ("/user2/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "222.122.136.110";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "KT-IDC";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$_SERVER['PHP_SELF']."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k]){
case 'INCOK' : echo "TRINEX"; break;
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
//$mode = "I'M YOUR FATHER. BASTARD !";
//$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$mode = "EVENT:INFO:ONE";
//$command = 'bin/raidmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
$command = 'bin/arcmond_client '.$pt->translateIt($result[$j][3],3).' 8787 "'.$mode.'"';
//echo $command;
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
#echo "NO EVENT";
echo "$raid_str[$last_num]";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$_SERVER['PHP_SELF']?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$$_SERVER['PHP_SELF']?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,443 @@
<?
require_once("inc/session.php");
$serviceType = isset($_GET['service_type']) ? $_GET['service_type'] : $_POST['service_type'];
if($serviceType == "") $serviceType = 0;
?>
<html>
<head>
<title>######## SYSTEM-HOSTING RAID STATUS PANNEL ######## </title>
<STYLE type=text/css>
TD { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TR { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; }
TABLE { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
INPUT { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: 'ARIAL,±¼¸²Ã¼'; TEXT-DECORATION: none; line-height : 120%}
}
</STYLE>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<link rel="stylesheet" href="clockstyle.css" type="text/css">
<style type="text/css">
#tooltip {position:absolute;
top:5;
left:5;
border:solid 3 ffccff;
background:ffffcc;
color:660066;
font-size:9pt;
width:200;
height:20;
padding:2;
overflow:hidden;
z-index:10;
display:none;
}
</style>
<? require "layer.js";?>
<script language="javascript1.2" type="text/javascript" src="clock.js" ></script>
<script language="javascript1.2">
var sh_win_obj =null;
function openBrWindow(theURL,winName,features) {
if(sh_win_obj!=null)sh_win_obj.close();
sh_win_obj=window.open(theURL,winName,features);
}
</script>
</head>
<body onLoad="UpdateClocks()">
<form name="frm" action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType ?>">
<table border="0" cellspacing="0" width="100%">
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock0" width="25%" > </td>
<td ID="Clock1" width="25%" > </td>
<td ID="Clock2" width="25%" > </td>
<td ID="Clock3" width="25%" > </td>
</tr>
<tr bgcolor=#003366 class="ratNavText">
<td ID="Clock4" width="25%" > </td>
<td ID="Clock5" width="25%" > </td>
<td ID="Clock6" width="25%" > </td>
<td ID="Clock7" width="25%" > </td>
</tr>
</table>
<br>
<table border="0" cellspacing="1" width="530" align="center">
<tr align="center">
<td> <h3>######## ICS SERVICE STATUS ########</h3></td>
</tr>
</table>
<?php
require_once ("/user2/service/wwwroot/sh_raid_monitor/inc/contact.html");
?>
<marquee id="tooltip" name="tooltip"></marquee>
<?
$server_addr[0][0] = "222.122.136.110";
$server_addr[0][1] = "30001";
$server_addr[0][2] = "KT-IDC";
$str_request = "I'M YOUR FATHER. BASTARD !";
$tot = count($server_addr);
for($i=0; $i < $tot; $i++){
if($i%3 == 0) echo "<table align=\"center\"><tr>";
$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,"GET_SERVSTATUS", 15);
while(1) {
$test2 = fread($fp, 2048);
$test .= trim($test2);
$j = strlen($test2);
if($j < 1024) break;
}
fclose($fp);
}
?>
<td valign=top>
<?
$pt = new parsePipe();
$test = $pt->nullTrim($test);
//echo "<!-- $test -->";
$tmpArr = $pt->textArr($test);
$serviceName = $pt->serviceName($test);
$result = $pt->parseIt($tmpArr[$serviceType]);
$tot_tr = $pt->countIt();
echo " <table border=1 cellpadding=0 cellspacing=0>\n";
echo " <tr align=center>\n";
for($k=0; $k<sizeof($serviceName); $k++) {
echo " <td width='90' height='35'>\n";
echo " <font size='4'>";
echo " <a href='".$PHP_SELF."?service_type=".$k."'>";
if($serviceType==$k) echo "<b>";
switch($serviceName[$k]){
case 'INCOK' : echo "TRINEX"; break;
default : echo $serviceName[$k]; break;
}
if($serviceType==$k) echo "</b>";
echo " </a>";
echo " </font>";
echo " </td>\n";
}
echo " </tr>\n";
echo " </table>\n";
?>
<table border=1 cellpadding=1 cellspacing=0>
<tr height="60">
<td colspan="10">
<center><b>
<font color="#000066" size="5">
<?= $serviceName[$serviceType] ?><br><br>
</font>
<font color="#000066" size="4">
MNG SERVER IP: <?=$server_addr[$i][0]?>,&nbsp;&nbsp; PORT: <?=$server_addr[$i][1]?>
(<?=$server_addr[$i][2]?>)
</font>
</b>
</center>
</td>
</tr>
<tr align="center">
<td width="170"><center><b><font color="#000066">Name</font></b></center></td>
<td width="110"><center><b><font color="#000066">Server IP</font></b></center></td>
<td width="50"><center><b><font color="#000066">Server Port</font></b></center></td>
<td width="150"><center><b><font color="#000066">Last Status <!--Changed-->Checked At</font></b></center></td>
<td width="70"><center><b><font color="#000066">Raid</font></b></center></td>
</tr>
<?
for($j=0; $j<$tot_tr; $j++){
$alt_str = "[$j]".
" [SERVER STATUS] : ".$pt->translateIt($result[$j][0], 2).
" [SERVER NAME] : ".$pt->translateIt($result[$j][2],2).
" [SERVER IP] : ".$pt->translateIt($result[$j][3],3).
" [SERVER PORT] : ".$pt->translateIt($result[$j][4],4);
if(substr_count($pt->translateIt($result[$j][2],3), "RTS") == 0 && substr_count($pt->translateIt($result[$j][2],3), "FHS")==0) continue;
$command = "bin/arcmond_client ".$pt->translateIt($result[$j][3],3)." 8787 1";
$raid_res = exec($command);
echo "<!-- raid_res : $raid_res -->";
$raid_str = explode(":",$raid_res);
?>
<span onmouseover="showtip('<?=$alt_str?>');" onmouseout="hidetip();">
<tr>
<td>(<?=$pt->translateIt($result[$j][0],1)?>&nbsp;<?=$pt->translateIt($result[$j][1],0)?>)&nbsp;<?=$result[$j][2]?></td>
<td align="center"><?=$pt->translateIt($result[$j][3],3)?></td>
<td align="center"><?=$pt->translateIt($result[$j][4],4)?></td>
<td align="center"><?=date("Y-m-d H:i:s", $raid_str[1])?></td>
</td>
<td>
<?
$raid_res="";
$last_num = count($raid_str) - 1;
//echo $raid_str[0]."<br>";
//echo $command;
if($raid_str[0]=="0")
{
echo $pt->translateIt(1,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "NO EVENT";
echo "</a>";
//echo $raid_str[2];
}
elseif($raid_str[0]=="1")
{
echo $pt->translateIt(2,1);
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "$raid_str[$last_num]";
echo "</a>";
}
else
{
echo $pt->translateIt(0,1);
//echo "<a target=_blank href='raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2'>";
echo "<a href=\"javascript:openBrWindow('raid_view.html?ip=".$pt->translateIt($result[$j][3],3)."&mode=2','viewDetail','width=600, height=650, left=300,top=300, resizable=no, scrollbars=yes, status=yes')\" >";
echo "check err $raid_str[2]$raid_str[3]";
echo "</a>";
}
?>
</td>
</tr>
</span>
<?
}
?>
<!--
<tr>
<td align="center" colspan="6"><b>Storage Total</b></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($totalDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($freeDisk, 9)?></td>
<td align="center"><?= ($totalDisk == "") ? "-" : $pt->translateIt($usedDisk, 9)?></td>
<td align="center">.</td>
</tr>
-->
</table></td>
<?
if($i%3 == 2) echo "</table></tr>"; //
}
?>
<table>
</table>
<?
////////////////////
//Print REFRESHER
////////////////////
extract($_POST);
if($refresh_rate<1 || $refresh_rate>1000)
$refresh_rate = 60;
?>
<br>
<table align="center">
<tr>
<td>
Refresh Rate :
<input type=text name=refresh_rate value=<?=$refresh_rate?>>
<input type=submit value=SET>
(MIN : 1, MAX : 1000)
<input type="hidden" name="chk" value="0">
</form>
</td>
</tr><tr>
<td align=right>
<form action=<?=$PHP_SELF?> method=POST>
<input type="hidden" name="service_type" value="<?= $serviceType?>">
<input type=hidden name=refresh_rate value=30>
<input type=submit value=RESET(30)>
</form>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript" src="tooltip.js" ></script>
<script language=javascript>
function showtip(text) {
tooltip.innerText=text;
tooltip.style.display="inline";
}
function hidetip() {
tooltip.style.display="none";
}
function movetip() {
tooltip.style.pixelTop=event.y+document.body.scrollTop;
tooltip.style.pixelLeft=event.x+document.body.scrollLeft+10;
}
document.onmousemove=movetip;
</script>
</body>
</html>
<META http-equiv="refresh" content="<?=$refresh_rate?>; url=<?=$PHP_SELF?>?refresh_rate=<?=$refresh_rate?>&service_type=<?= $serviceType ?>">
<?
########
#CLASSES
########
class parsePipe {
var $tot_line;
function parseIt($givenText){
$cnt = 0;
$minValue = 0;
$maxValue = 0;
$tmp_arr = array();
$temp_arr = explode("\r\n", $givenText);
$result_arr[$i][9] = "";
$this->tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1;
for($i=0; $i < $this->tot_line; $i++){
if($temp_arr[$i]!='') {
$result_arr[$i] = explode("|", $temp_arr[$i]);
$result_arr[$i][10] = "";
$tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]);
$result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]);
$result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]);
if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) {
if($cnt == 0) {
$minValue = $result_arr[$i][9];
$cnt++;
}
if($minValue > $result_arr[$i][9]) {
$minValue = $result_arr[$i][9];
}
}
}
}
$cnt = 0;
arsort($tmp_arr);
reset($tmp_arr);
while (list ($key, $val) = each ($tmp_arr)) {
//echo "$key = $val<br>";
if($val != 0) {
if($cnt == 0) {
$maxValue = $val;
$result_arr[$key][10] = "99FFFF";
$cnt++;
} else {
//if($minValue == $val) {
if($val < (2 * 1024 * 1024 * 1024 * 10)) {
$result_arr[$key][10] = "red";
}else if(($maxValue - $val) < (1024 * 1024 * 1024)) {
//echo "1GB Highed<br>";
$result_arr[$key][10] = "99FFFF";
} else {
//echo "1GB Lowed<br>";
$result_arr[$key][10] = "yellow";//$maxValue;
}
}
} else {
$result_arr[$key][10] = "white";
}
}
return $result_arr;
}
function countIt(){
return $this->tot_line;
}
function translateIt($parsedText, $type){
if($parsedText == '') return;
$eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB");
/*$eStatus = array('<img src=images/bu16.gif width=11 height=11>UNKNOWN',
'<img src=images/O EVENTbu14.gif width=11 height=11>ALIVE',
'<img src=images/bu15.gif width=11 height=11>DEAD');*/
$eStatus = array('<img src=images/bu16.gif width=11 height=11>',
'<img src=images/bu14.gif width=11 height=11>',
'<img src=images/bu15.gif width=11 height=11>');
$eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD');
switch($type){
case 0:
return $eServerType[$parsedText];
case 1:
return $eStatus[$parsedText];
case 2:
return $eStatusChar[$parsedText];
case 8:
if(trim($parsedText) == "-" || $parsedText == "") return "-";
else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024);
case 9:
if(trim($parsedText) == "-" || $parsedText == "" ) return "-";
else {
if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) {
return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024);
} else
return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024);
}
default:
return $parsedText;
}
}
function nullTrim($tmp_str)
{
$return_str = "";
$maxLength = strlen($tmp_str);
for($i=0 ; $i < $maxLength ; $i++) {
if(ord(substr($tmp_str, $i, 1)) != 0) {
$return_str .= substr($tmp_str, $i, 1);
}
}
return $return_str;
}
function textArr($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
//$str_arr[$cnt][30] = $search_str[0];
//echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."<br>";
$cnt++;
}
$str_arr[$cnt] .= $temp_arr[$i]."\r\n";
}
return $str_arr;
}
function serviceName($text)
{
$cnt = -1;
$tmp_cnt = 0;
$str_arr = array();
$tmp_search_str = "";
$temp_arr = explode("\r\n", $text);
for($i=0; $i<sizeof($temp_arr); $i++) {
$split_str = explode("|", $temp_arr[$i]);
$search_str = explode("_", $split_str[2]);
if($tmp_search_str != $search_str[0]) {
$tmp_search_str = $search_str[0];
$cnt++;
}
$str_arr[$cnt] = $tmp_search_str;
}
return $str_arr;
}
}
?>
@@ -0,0 +1,69 @@
<?
$ip = $_GET["ip"];
$mode = $_GET["mode"];
if($ip=="" || $mode=="")
{
echo "IP & MODE REQUIRED";
exit;
}
switch ($mode)
{
case 1:
//$mode = "I'M YOUR FATHER. BASTARD !";
$mode = "EVENT:INFO:ONE";
break;
case 2:
//$mode = "I'M YOUR GOD. BASTARD !";
$mode = "EVENT:INFO:ALL";
break;
}
//$command = 'bin/raidmond_client '.$ip.' 8787 "'.$mode.'"';
$command = 'bin/arcmond_client '.$ip.' 8787 "'.$mode.'"';
#echo $command."<br/>";
exec($command, $raid_res);
$raid_str = explode(":", $raid_res[0]);
//if($raid_str[0]==1){
if(1==1){
echo "<table border=\"1\" width=\"565\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo " <tr>\n";
echo " <td colspan=\"2\">\n";
echo " <font size=3><b>IP : $ip</b></font> Checked at ".date("Y-m-d H:i:s", $raid_str[1])." <br> ";
echo " </td>\n";
echo " </tr>\n";
$to_eli = $raid_str[0].":".$raid_str[1].":";
$raid_res[0] = str_replace($to_eli,"",$raid_res[0]);
$tot = count($raid_res);
for($i=0; $i < $tot; $i++) {
$raid_res2 = explode("] ", str_replace("[", "", trim($raid_res[$i])));
if($raid_res2[0] != "" && substr_count($raid_res2[0], "Disabled") == 0) {
echo " <tr>\n";
echo " <td width=\"160\" align=\"center\">\n";
echo $raid_res2[0];
echo " </td>\n";
echo " <td>&nbsp;\n";
echo $raid_res2[1];
echo " </td>\n";
echo " </tr>\n";
}else if(substr_count($raid_res2[0], "Disabled") > 0) {
echo " <tr>\n";
echo " <td align=\"center\" colspan=\"2\">\n";
echo $raid_res2[0];
echo " </td>\n";
echo " </tr>\n";
}
}
echo "</table>\n";
}else{
echo $raid_res;
echo "aa";
}
echo "<input type=button name=close value=close onclick='window.close()'>";
?>
@@ -0,0 +1,69 @@
<?
$ip = $_GET["ip"];
$mode = $_GET["mode"];
if($ip=="" || $mode=="")
{
echo "IP & MODE REQUIRED";
exit;
}
switch ($mode)
{
case 1:
//$mode = "I'M YOUR FATHER. BASTARD !";
$mode = "EVENT:INFO:ONE";
break;
case 2:
//$mode = "I'M YOUR GOD. BASTARD !";
$mode = "EVENT:INFO:ALL";
break;
}
//$command = 'bin/raidmond_client '.$ip.' 8787 "'.$mode.'"';
$command = 'bin/arcmond_client '.$ip.' 8787 "'.$mode.'"';
#echo $command."<br/>";
exec($command, $raid_res);
$raid_str = explode(":", $raid_res[0]);
//if($raid_str[0]==1){
if(1==1){
echo "<table border=\"1\" width=\"565\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo " <tr>\n";
echo " <td colspan=\"2\">\n";
echo " <font size=3><b>IP : $ip</b></font> Checked at ".date("Y-m-d H:i:s", $raid_str[1])." <br> ";
echo " </td>\n";
echo " </tr>\n";
$to_eli = $raid_str[0].":".$raid_str[1].":";
$raid_res[0] = str_replace($to_eli,"",$raid_res[0]);
$tot = count($raid_res);
for($i=0; $i < $tot; $i++) {
$raid_res2 = explode("] ", str_replace("[", "", trim($raid_res[$i])));
if($raid_res2[0] != "" && substr_count($raid_res2[0], "Disabled") == 0) {
echo " <tr>\n";
echo " <td width=\"160\" align=\"center\">\n";
echo $raid_res2[0];
echo " </td>\n";
echo " <td>&nbsp;\n";
echo $raid_res2[1];
echo " </td>\n";
echo " </tr>\n";
}else if(substr_count($raid_res2[0], "Disabled") > 0) {
echo " <tr>\n";
echo " <td align=\"center\" colspan=\"2\">\n";
echo $raid_res2[0];
echo " </td>\n";
echo " </tr>\n";
}
}
echo "</table>\n";
}else{
echo $raid_res;
echo "aa";
}
echo "<input type=button name=close value=close onclick='window.close()'>";
?>
@@ -0,0 +1,55 @@
<?
$ip = $_GET["ip"];
$mode = $_GET["mode"];
if($ip=="" || $mode=="")
{
echo "IP & MODE REQUIRED";
exit;
}
$command = "bin/arcmond_client $ip 8787 $mode";
exec($command, $raid_res);
$raid_str = explode(":", $raid_res[0]);
//if($raid_str[0]==1){
if(1==1){
echo "<table border=\"1\" width=\"565\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo " <tr>\n";
echo " <td colspan=\"2\">\n";
echo " <font size=3><b>IP : $ip</b></font> Checked at ".date("Y-m-d H:i:s", $raid_str[1])." <br> ";
echo " </td>\n";
echo " </tr>\n";
$to_eli = $raid_str[0].":".$raid_str[1].":";
$raid_res[0] = str_replace($to_eli,"",$raid_res[0]);
$tot = count($raid_res);
for($i=0; $i < $tot; $i++) {
$raid_res2 = explode("] ", str_replace("[", "", trim($raid_res[$i])));
if($raid_res2[0] != "" && substr_count($raid_res2[0], "Disabled") == 0) {
echo " <tr>\n";
echo " <td width=\"160\" align=\"center\">\n";
echo $raid_res2[0];
echo " </td>\n";
echo " <td>&nbsp;\n";
echo $raid_res2[1];
echo " </td>\n";
echo " </tr>\n";
}else if(substr_count($raid_res2[0], "Disabled") > 0) {
echo " <tr>\n";
echo " <td align=\"center\" colspan=\"2\">\n";
echo $raid_res2[0];
echo " </td>\n";
echo " </tr>\n";
}
}
echo "</table>\n";
}else{
echo $raid_res;
echo "aa";
}
echo "<input type=button name=close value=close onclick='window.close()'>";
?>
@@ -0,0 +1,4 @@
<?
$fp = popen ("/bin/ls", "r");
echo "OK";
?>

Some files were not shown because too many files have changed in this diff Show More