<?php
require("./total.inc");


session_start();
require("./ninsyou.inc");
if(0 > ninsyou_check(5)){
   exit;
   }


echo "<HTML>";
echo "<HEAD>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=EUC-JP'>";
echo "<TITLE>Zither server Administration tool 'Apollon'</TITLE>";

echo "<style type='text/css'>";
echo "<!--
a { text-decoration:none; }
a:hover { text-decoration:underline; }
a:hover { color:red; }

.example { 
width: 100%; 
max-width: 100px; 
min-width: 90px; 
} 

-->";
echo "</style>";

echo "</HEAD>";






// Cname Bname List 
$conn = db_connect();
if(!$conn){
   echo "not connection!<br>";
   exit;
   }

//  監視ブロック名リスト作成
$bname_count = 0;
$result = db_query($conn, "select distinct(bname) from userblock;");
if(!$result){
   print("banem select , bud query\n");
   exit;
   }
$num = db_num_rows($result);
if($num > 0){
   while($bname_count < $num){
      $bname_data[$bname_count] = enco_rtrim(db_fetch_Result($result, $bname_count, bname));
      $result1=db_query($conn,"select distinct(cname) from userblock where bname='$bname_data[$bname_count]';");
      if(!$result1){
         print("bname , canem select , bud query\n");
         exit;
         }
      $num1 = db_num_rows($result1);
      if($num1 > 0){
         $cname_data[$bname_count] = enco_rtrim(db_fetch_Result($result1, 0, cname));
         }
      $bname_count++;
      }
   }
else{
   print("NG 監視ブロックが無いです \n");
   }
db_free_result($result);
db_free_result($result1);


$cname_count = 0;
$result=db_query($conn,"select distinct(cname) from connection;");
if(!$result){
   print("canem select , bud query\n");
   exit;
   }
$num = db_num_rows($result);
if($num > 0){
   while($cname_count < $num){
      $xcname_data[$cname_count] = enco_rtrim(db_fetch_Result($result, $cname_count, cname));
      $cname_count++;
      }
   }
db_free_result($result);
db_Close($conn);
// Cname Bname List 




echo "<center>";
print("<BODY Link='#FF8C00' Vlink='#FF8C00' Alink='#FF8C00'  bgcolor='$my_bgcolor' >\n");

// 接続クライアント検索

echo "<h2 id='error'>";
echo "</h2>";
echo "<TABLE border='0' bgcolor='FFA500' cellspacing='3' cellpadding='0' width=125>";
echo "<tr>";
echo "<td align=center>";
echo "<font color='ffffff' size=2>";
echo "<b>";
echo "ブロック検索";
echo "</b>";
echo "</font>";
echo "</td>";
echo "</tr>";

echo "</table>";

echo "<a href='./monitor_manu.php?QUE_DATA=KENSAKU4' target='top'>この項目のマニュアル</a>";
echo "<br>";


echo "<FORM METHOD=GET ACTION='block.php' target='top'>";
echo "<TABLE border='0' bgcolor='FFEBCD' cellspacing='8' cellpadding='0' width=125>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視クライアント名";
echo "<select size=1 name=CNAME class='example'>";
echo "<option value=''>なし";
for($select_count = 0; $select_count < $cname_count; $select_count++){
   echo "<option value=$xcname_data[$select_count]>$xcname_data[$select_count]";
   }
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=CNAME_CH>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視ブロック名";
echo "<select size=1 name=BNAME class='example'>";
echo "<option value=''>なし";
for($select_count = 0; $select_count < $bname_count; $select_count++){
   echo "<option value=$bname_data[$select_count]>$bname_data[$select_count] ($cname_data[$select_count])";
   }
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=BNAME_CH>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視ブロック名(LIKE)";
echo "<INPUT type='text' NAME=BNAME2 class='example' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=BNMAE2_CH>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "実行状態";
echo "<select size=1 name=STAT>";
echo "<option value=>なし";
echo "<option value=NOT>NON";
echo "<option value=JUST>JUST";
echo "<option value=FOR>FOR";
echo "<option value=RES>RES";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=STAT_CH>";
echo "</td>";
echo "</tr>";




echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視開始時刻(LIKE)";
echo "<INPUT type='text' NAME=STARTTIME size='5' value='%' maxlength=5>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=STARTTIME_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視停止時刻(LIKE)";
echo "<INPUT type='text' NAME=STOPSETTIME size='5' value='%' maxlength=5>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=STOPSETTIME_CH>";
echo "</td>";
echo "</tr>";



echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "メールON、OFF";
echo "<select size=1 name=MAILSEND>";
echo "<option value=>なし";
echo "<option value=OFF>停止";
echo "<option value=ON>送信";
echo "<option value=MID>間欠1";
echo "<option value=MIX>間欠2";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=MAILSEND_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "MAIL TO:";
echo "<INPUT type='text' NAME=MAILTO class='example' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=MAILTO_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "MAIL CC:";
echo "<INPUT type='text' NAME=MAILCC class='example' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=MAILCC_CH>";
echo "</td>";
echo "</tr>";



echo "<tr>";
echo "<td align=center>";
echo "監視インターバル(加算秒)\n";
echo "<select size=1 name=PLUSTIME>";
echo "<option value='' selected>なし";
echo "<option value=60>1分";
echo "<option value=120>2分";
echo "<option value=180>3分";
echo "<option value=240>4分";
echo "<option value=300>5分";
echo "<option value=360>6分";
echo "<option value=420>7分";
echo "<option value=480>8分";
echo "<option value=540>9分";
echo "<option value=600>10分";
echo "<option value=900>15分";
echo "<option value=1200>20分";
echo "<option value=1500>25分";
echo "<option value=1800>30分";
echo "<option value=2100>35分";
echo "<option value=2400>40分";
echo "<option value=2700>45分";
echo "<option value=3000>50分";
echo "<option value=3300>55分";
echo "<option value=3600>1時間";
echo "</select>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=PLUSTIME_CH>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "管理番号";
echo "<INPUT type='text' NAME=UNO class='example' value=''>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=UNO_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "<input type=submit value='検索'>";
echo "</font>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";


echo "<br>";

echo "</center>";

?>

</BODY>
</HTML>
