<?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: 80px;
min-width: 50px;
}

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

echo "</HEAD>";



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


// 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 "<h2 id='error'></h2>";
echo "<TABLE border='0' bgcolor='FFA500' cellspacing='3' cellpadding='0' width=125>";
echo "<tr><td align=center><font color='ffffff' size=2><b>エラーログ検索</b></font></td></tr>";
echo "</table>";

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

echo "<FORM METHOD=GET ACTION='./monitor_select.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=YE>";
echo "<option value=>not";
echo "<option value=2006>2006";
echo "<option value=2007>2007";
echo "<option value=2008>2008";
echo "<option value=2009>2009";
echo "<option value=2010>2010";
echo "<option value=2011>2011";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=YE_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "発生月";
echo "<select size=1 name=MO>";
echo "<option value=>not";
echo "<option value=1>1";
echo "<option value=2>2";
echo "<option value=3>3";
echo "<option value=4>4";
echo "<option value=5>5";
echo "<option value=6>6";
echo "<option value=7>7";
echo "<option value=8>8";
echo "<option value=9>9";
echo "<option value=10>10";
echo "<option value=11>11";
echo "<option value=12>12";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=MO_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "発生日";
echo "<select size=1 name=DA>";
echo "<option value=>not";
echo "<option value=1>1";
echo "<option value=2>2";
echo "<option value=3>3";
echo "<option value=4>4";
echo "<option value=5>5";
echo "<option value=6>6";
echo "<option value=7>7";
echo "<option value=8>8";
echo "<option value=9>9";
echo "<option value=10>10";
echo "<option value=11>11";
echo "<option value=12>12";
echo "<option value=13>13";
echo "<option value=14>14";
echo "<option value=15>15";
echo "<option value=16>16";
echo "<option value=17>17";
echo "<option value=18>18";
echo "<option value=19>19";
echo "<option value=20>20";
echo "<option value=21>21";
echo "<option value=22>22";
echo "<option value=23>23";
echo "<option value=24>24";
echo "<option value=25>25";
echo "<option value=26>26";
echo "<option value=27>27";
echo "<option value=28>28";
echo "<option value=29>29";
echo "<option value=30>30";
echo "<option value=31>31";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=DA_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "発生時";
echo "<select size=1 name=HA>";
echo "<option value=>not";
echo "<option value=0>0";
echo "<option value=1>1";
echo "<option value=2>2";
echo "<option value=3>3";
echo "<option value=4>4";
echo "<option value=5>5";
echo "<option value=6>6";
echo "<option value=7>7";
echo "<option value=8>8";
echo "<option value=9>9";
echo "<option value=10>10";
echo "<option value=11>11";
echo "<option value=12>12";
echo "<option value=13>13";
echo "<option value=14>14";
echo "<option value=15>15";
echo "<option value=16>16";
echo "<option value=17>17";
echo "<option value=18>18";
echo "<option value=19>19";
echo "<option value=20>20";
echo "<option value=21>21";
echo "<option value=22>22";
echo "<option value=23>23";
echo "<option value=24>24";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=HA_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "発生分";
echo "<select size=1 name=MI>";
echo "<option value=>not";
echo "<option value=0>0";
echo "<option value=1>1";
echo "<option value=2>2";
echo "<option value=3>3";
echo "<option value=4>4";
echo "<option value=5>5";
echo "<option value=6>6";
echo "<option value=7>7";
echo "<option value=8>8";
echo "<option value=9>9";
echo "<option value=10>10";
echo "<option value=11>11";
echo "<option value=12>12";
echo "<option value=13>13";
echo "<option value=14>14";
echo "<option value=15>15";
echo "<option value=16>16";
echo "<option value=17>17";
echo "<option value=18>18";
echo "<option value=19>19";
echo "<option value=20>20";
echo "<option value=21>21";
echo "<option value=22>22";
echo "<option value=23>23";
echo "<option value=24>24";
echo "<option value=25>25";
echo "<option value=26>26";
echo "<option value=27>27";
echo "<option value=28>28";
echo "<option value=29>29";
echo "<option value=30>30";
echo "<option value=31>31";
echo "<option value=32>32";
echo "<option value=33>33";
echo "<option value=34>34";
echo "<option value=35>35";
echo "<option value=36>36";
echo "<option value=37>37";
echo "<option value=38>38";
echo "<option value=39>39";
echo "<option value=40>40";
echo "<option value=41>41";
echo "<option value=42>42";
echo "<option value=43>43";
echo "<option value=44>44";
echo "<option value=45>45";
echo "<option value=46>46";
echo "<option value=47>47";
echo "<option value=48>48";
echo "<option value=49>49";
echo "<option value=50>50";
echo "<option value=51>51";
echo "<option value=52>52";
echo "<option value=53>53";
echo "<option value=54>54";
echo "<option value=55>55";
echo "<option value=56>56";
echo "<option value=57>57";
echo "<option value=58>58";
echo "<option value=59>59";
echo "<option value=60>60";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=MI_CH>";
echo "</td>";
echo "</tr>";



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 "監視クライアント名(LIKE)";
echo "<INPUT type='text' NAME=CNAME2 size='12' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=CNAME2_CH>";
echo "</td>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視ブロック名";
echo "<select size=1 name=FREE4 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=FREE4_CH>";
echo "</td>";
echo "</tr>";


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


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視先の情報(LIKE)";
echo "<INPUT type='text' NAME=PINFO size='12' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=PINFO_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視先IP";
echo "<INPUT type='text' NAME=CINFO size='12' value=''>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=CINFO_CH>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視先IP(LIKE)";
echo "<INPUT type='text' NAME=CINFO2 size='12' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=CINFO2_CH>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "ポート番号";
echo "<INPUT type='text' NAME=PORT size='12' value=''>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=PORT_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "MIB(LIKE)";
echo "<INPUT type='text' NAME=COM size='12' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=COM_CH>";
echo "</td>";
echo "</tr>";

//echo "<tr>";
//echo "<td align=center>";
//echo "<font color='FF8C00' size=2>";
//echo "<INPUT type='hidden' NAME=FREE4 size='12'>";
//echo "</font>";
//echo "</td>";
//echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視情報(LIKE)";
echo "<INPUT type='text' NAME=FREE1 size='12' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=FREE1_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "エラー詳細(LIKE)";
echo "<INPUT type='text' NAME=ERRDATA size='12' value='%'>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=ERRDATA_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "監視属性";
echo "<select size=1 name=MONITOR>";
echo "<option value=>属性(未選択)";
echo "<option value=PORT>ポートスキャン";
echo "<option value=COMAND>コマンド";
echo "<option value=SNMP>SNMPチェック";
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=MONITOR_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "プロトコル";
echo "<select size=1 name=PROTO>";
echo "<option value=>未選択";
print("<option value=ICMP>ICMP疎通確認");
print("<option value=UDP>UDPポート");
print("<option value=TCP>TCPポート");
print("<option value=URL>URL status");
print("<option value=SMTP>SMTP status");
print("<option value=FTP>FTP status");
print("<option value=POP>POP status");
print("<option value=SSH>SSH status");
print("<option value=SNTP>NTPの時間");
print("<option value=HOST>DNS名前検索");
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=PROTO_CH>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "プライオリティ";
echo "<select size=1 name=PRINO>";
echo "<option value=>未選択";
print("<option value=1>1最強");
print("<option value=2>2通常");
print("<option value=3>3メール無し");
print("<option value=4>4 TEST");
print("<option value=5>5 LOGING");
print("<option value=11>監視ログ(11)");
print("<option value=12>監視ログ(12)");
print("<option value=13>監視ログ(13)");
echo "</select>";
echo "</font>";
echo "</td>";
echo "<td>";
echo "<INPUT type='checkbox' NAME=PRINO_CH>";
echo "</td>";
echo "</tr>";



echo "<tr>";
echo "<td align=center>";
echo "<font color='FF8C00' size=2>";
echo "チェック時はCSV出力";
// echo "<INPUT type='hidden' NAME=CNAME >";
echo "<INPUT type='checkbox' NAME=CSV_CH>";
echo "<input type=submit value='検索'>";
echo "</font>";
echo "</td>";
echo "</tr>";

echo "</table>";
echo "</form>";
echo "<br>";

echo "</center>";

?>

</BODY>
</HTML>
