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

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


echo "<!DOCTYP:pserver:cvs@dhcvs.ms-n.com:/usr/home/cvsE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>";
echo "<HTML>";
echo "<HEAD>";
echo "<META name='GENERATOR' content='AmBuilder'>";
echo "<META http-equiv='Content-Type' content='text/html; charset=euc-jp'>";
	echo "<title>zither monitorring save info</title>";

echo "<SCRIPT LANGUAGE='JavaScript'>";
echo "<!--

function WinCls(){
        window.close()
                       }
// window.onload=WinCls();
//-->";
echo "</SCRIPT>";


$CNAME = enco($_GET["CNAME"]);
$CIP = enco($_GET["CIP"]);


if(0 != strlen($CNAME)){

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

$result = db_query($conn, "select * from config where c_name='$CNAME'");
if(!$result){
   print("bud query\n");
   exit;
   }

$num = db_num_rows($result);
if($num <= 0){
   print("no data\n");
   exit;
   }

$s = 0;
while($s < $num){

   $C_NAME = enco_rtrim(db_fetch_Result($result, $s, c_name));
   $C_INFO = enco_rtrim(db_fetch_Result($result, $s, c_info));
   $SOCK_IPADDR = enco_rtrim(db_fetch_Result($result, $s, sock_ipaddr));
   $SOCK2_IPADDR = enco_rtrim(db_fetch_Result($result, $s, sock2_ipaddr));
   $SOCK_PORT = enco_rtrim(db_fetch_Result($result, $s, sock_port));
   $SOCK2_PORT = enco_rtrim(db_fetch_Result($result, $s, sock2_port));
   $BAT_FILE = enco_rtrim(db_fetch_Result($result, $s, bat_file));
   $BAT2_FILE = enco_rtrim(db_fetch_Result($result, $s, bat2_file));
   $COMMAND_PATH = enco_rtrim(db_fetch_Result($result, $s, command_path));
   $BAT_INT = enco_rtrim(db_fetch_Result($result, $s, bat_int));
   $BAT2_INT = enco_rtrim(db_fetch_Result($result, $s, bat2_int));
   $LIFE_INT = enco_rtrim(db_fetch_Result($result, $s, life_int));
   $LIFE_LOS = enco_rtrim(db_fetch_Result($result, $s, life_los));
   $MAIL_CC = enco_rtrim(db_fetch_Result($result, $s, mail_cc));
   $UPDATE_COM = enco_rtrim(db_fetch_Result($result, $s, update_com));

   $s++;
   }

db_free_result($result);
db_Close($conn);

}


print("</head>\n");
print("<body alink='#ff0000' bgcolor='$my_bgcolor' link='#0000ff' text='#000000' vlink='#000080'>\n");

print("<TABLE border='0' bgcolor='FFA500' cellspacing='3' cellpadding='0' width=100%>\n");
print("<tr><td align=left><font color='ffffff'><b>　監視設定 -> 編集</b></font></td></tr>\n");
print("</table>\n");

echo "<pre>";
print($font_size);
print($version_name);
print(date("Y m d g i s A"));
print("\n");
print("監視クライアントの起動ファイルを新規作成できます\n");
print("同時に見本となる監視項目を追加出来ます。\n");
print("監視の内容はすべてテストモードとなります\n");

echo "\n";
echo "<FORM METHOD=GET ACTION='config_upnew.php' target=config_upnew>";

echo "<TABLE cellspacing=0 cellpadding=3 nowrap border=1 Bordercolor='$my_bocolor' nowrap border=0 WIDTH='790' height='8%'BGCOLOR='#e6e8fa'>";


// echo "<TABLE  cellspacing=0 cellpadding=3 nowrap border=0 Bordercolor='$my_bocolor' nowrap border=0  WIDTH='90%' height='8%'BGCOLOR='#e6e8fa'>";

echo "<tr><td>";
echo "監視クライアントのホスト名 \n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=C_NAME size='32' value=''>";
   }
else{
   echo "<INPUT type='text' NAME=C_NAME size='32' value='$C_NAME'>";
   }
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視クライアントのIPアドレス\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=CIP size='24' value='$CIP'>";
echo "</td></tr>";

echo "<tr><td>";
echo "監視クライアントの情報\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=C_INFO size='100' value='フォーマットそろえると便利'>";
   }
else{
   echo "<INPUT type='text' NAME=C_INFO size='100' value='$C_INFO'>";
   }
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視サーバIP \n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=SOCK_IPADDR size='24' value='$my_server_ip'>";
   }
else{
   echo "<INPUT type='text' NAME=SOCK_IPADDR size='24' value='$SOCK_IPADDR'>";
   }
echo "</td></tr>";

echo "<tr><td>";
echo "監視サーバのポート\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=SOCK_PORT size='6' value='9988'>";
   }
else{
   echo "<INPUT type='text' NAME=SOCK_PORT size='6' value='$SOCK_PORT'>";
   }
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視サーバIP \n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=SOCK2_IPADDR size='24' value='$my_server_ip'>";
   }
else{
   echo "<INPUT type='text' NAME=SOCK2_IPADDR size='24' value='$SOCK2_IPADDR'>";
   }
echo "</td></tr>";

echo "<tr><td>";
echo "監視サーバのポート\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=SOCK2_PORT size='6' value='9988'>";
   }
else{
   echo "<INPUT type='text' NAME=SOCK2_PORT size='6' value='$SOCK2_PORT'>";
   }
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "一時ファイル\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=BAT_FILE size='80' value='/usr/local/zither/tmp/sitar.bat'>";
   }
else{
   echo "<INPUT type='text' NAME=BAT_FILE size='80' value='$BAT_FILE'>";
   }
echo "</td></tr>";

echo "<tr><td>";
echo "一時ファイル\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=BAT2_FILE size='80' value='/usr/local/zither/tmp/sitar.list'>";
   }
else{
   echo "<INPUT type='text' NAME=BAT2_FILE size='80' value='$BAT2_FILE'>";
   }
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "コマンドの置き場所\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=COMMAND_PATH size='80' value='/usr/local/zither/sample_bin'>";
   }
else{
   echo "<INPUT type='text' NAME=COMMAND_PATH size='80' value='$COMMAND_PATH'>";
   }
echo "</td></tr>";

echo "<tr><td>";
echo "監視インターバル \n";
echo "</td><td>";
echo "<select size=1 name=BAT_INT>";
if(0 == strlen($CNAME)){ 
   echo "<option value=$BAT_INT selected>$BAT_INT";
   }
else{
   echo "<option value=60 selected>60";
   }
echo "<option value=60>60";
echo "<option value=30>30";
echo "<option value=60>60";
echo "<option value=90>90";
echo "<option value=120>120";
echo "<option value=150>150";
echo "<option value=180>180";
echo "<option value=210>210";
echo "<option value=240>240";
echo "</select>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視インターバル\n";
echo "</td><td>";
echo "<select size=1 name=BAT2_INT>";
if(0 == strlen($CNAME)){ 
   echo "<option value=$BAT2_INT selected>$BAT2_INT";
   }
else{
   echo "<option value=60 selected>60";
   }
echo "<option value=30>30";
echo "<option value=60>60";
echo "<option value=90>90";
echo "<option value=120>120";
echo "<option value=150>150";
echo "<option value=180>180";
echo "<option value=210>210";
echo "<option value=240>240";
echo "</select>";
echo "</td></tr>";

echo "<tr><td>";
echo "疎通監視インターバル\n";
echo "</td><td>";
echo "<select size=1 name=LIFE_INT>";
if(0 == strlen($CNAME)){ 
   echo "<option value=$LIFE_INT selected>$LIFE_INT";
   }
else{
   echo "<option value=20 selected>20";
   }
echo "<option value=10>10";
echo "<option value=15>15";
echo "<option value=20>20";
echo "<option value=25>25";
echo "<option value=30>30";
echo "<option value=60>60";
echo "</select>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "疎通監視の閾値\n";
echo "</td><td>";
echo "<select size=1 name=LIFE_LOS>";
if(0 == strlen($CNAME)){ 
   echo "<option value=$LIFE_LOS selected>$LIFE_LOS";
   }
else{
   echo "<option value=5 selected>5";
   }
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=7>7";
echo "<option value=10>10";
echo "<option value=15>15";
echo "</select>";
echo "</td></tr>";

echo "<tr><td>";
echo "めいるのCC\n";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=MAIL_CC size='60' value='$MAIL_CC'>";
   }
else{
   echo "<INPUT type='text' NAME=MAIL_CC size='60' value=''>";
   }
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "UPDATE用コマンドのパス";
echo "</td><td>";
if(0 == strlen($CNAME)){ 
   echo "<INPUT type='text' NAME=UPDATE_COM size='100' value='/usr/local/zither/bin/get_sitar.sh'>";
   }
else{
   echo "<INPUT type='text' NAME=UPDATE_COM size='100' value='$UPDATE_COM'>";
   }
echo "</td></tr>";

echo "<tr><td>";
echo "基本監視設定追加";
echo "</td><td>";
echo "<INPUT type='checkbox' value='ON' NAME=COM_MONITOR checked>";
echo "（クライアント名_defaultにて作成されます）";
echo "</td></tr>";

echo"</table>";

echo "\n";
echo "<font color=red>";
print("データベースに内容を反映し、同時にzitherサーバにも反映されます\n");
print("サーバに反映された場合は、自動で監視クライアントが再起動しますので注意してください\n");
echo "</font>";
echo "<input type=submit value='監視クライアントの作成'>";
echo "</form>";




print("</font>");

?>

</pre>
</body>
</html>


