<?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>";


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");


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

$EDIT = enco($_GET["EDIT"]);


echo "<pre>";
print($font_size);
print($version_name);
print(date("Y m d g i s A"));
print("\n");

if(0 == strcmp($EDIT, "UPNEW")){
   print("監視クライアント $CNMAE の複製を作ります \n");
   }
else{
   print("監視クライアント $CNAME の起動ファイルを編集できます\n");
   }


$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);




$result = db_query($conn, "select * from config2 where c_name='$CNAME'");
if(!$result){
   print("bud query table config2\n");
   }
else{
   $num = db_num_rows($result);
   if($num <= 0){
      print("error no data config2\n");
      }
   else{
      $s = 0;
      while($s < $num){

         $THREAD_MAX = enco_rtrim(db_fetch_Result($result, $s, thread_max));
         $TBUF_MAX = enco_rtrim(db_fetch_Result($result, $s, tbuf_max));
         $LIFE_ONOFF = enco_rtrim(db_fetch_Result($result, $s, life_onoff));
         $MID_MAX = enco_rtrim(db_fetch_Result($result, $s, mid_max));
         $THREAD_LEN = enco_rtrim(db_fetch_Result($result, $s, thread_len));
         $MID_INT = enco_rtrim(db_fetch_Result($result, $s, mid_int));
         $DNS_IP = enco_rtrim(db_fetch_Result($result, $s, DNS_IP));
         $DNS_IP2 = enco_rtrim(db_fetch_Result($result, $s, DNS_IP2));
         $MIDUMP_FILE = enco_rtrim(db_fetch_Result($result, $s, midump_file));
         $MIDUMP_FILE_2 = enco_rtrim(db_fetch_Result($result, $s, midump_file_2));
   
         $s++;
         }
      }
   db_free_result($result);
   }

db_Close($conn);


if(0 >= strlen($THREAD_MAX)){ $THREAD_MAX = 64; }
if(0 >= strlen($TBUF_MAX)){ $TBUF_MAX = 64; }
if(0 >= strlen($LIFE_ONOFF)){ $LIFE_ONOFF = 0; }
if(0 >= strlen($MID_MAX)){ $MID_MAX = 64; }
if(0 >= strlen($THREAD_LEN)){ $THREAD_LEN = 4; }
if(0 >= strlen($MID_INT)){ $MID_INT = 300; }


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

echo "<TABLE cellspacing=0 cellpadding=3 nowrap border=2 Bordercolor='ffffff' WIDTH='750' height='8%'BGCOLOR='#e6e8fa'>";

if(0 == strcmp($EDIT, "UPNEW")){
   echo "<tr><td width=200>";
   echo "監視クライアントのホスト名\n";
   echo "</td><td>";
   echo "<INPUT type='text' NAME=C_NAME value='$C_NAME'>";
   echo "</td></tr>";
   }
else{
   echo "<tr><td width=200>";
   echo "監視クライアントのホスト名\n";
   echo "</td><td>";
   echo "$C_NAME\n";
   echo "<INPUT type='hidden' NAME=C_NAME 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>";
echo "<INPUT type='text' NAME=C_INFO size='100' value='$C_INFO'>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視サーバのIP(1)\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=SOCK_IPADDR size='24' value='$SOCK_IPADDR'>";
echo "</td></tr>";

echo "<tr><td>";
echo "監視サーバのポート(1)\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=SOCK_PORT size='6' value='$SOCK_PORT'>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視サーバのIP(2)\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=SOCK2_IPADDR size='24' value='$SOCK2_IPADDR'>";
echo "</td></tr>";

echo "<tr><td>";
echo "監視サーバのポート(2)\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=SOCK2_PORT size='6' value='$SOCK2_PORT'>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "一時ファイル(1)\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=BAT_FILE size='80' value='$BAT_FILE'>";
echo "</td></tr>";

echo "<tr><td>";
echo "一時ファイル(2)\n";
echo "</td><td>";
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>";
echo "<INPUT type='text' NAME=COMMAND_PATH size='80' value='$COMMAND_PATH'>";
echo "</td></tr>";

echo "<tr><td>";
echo "監視インターバル(1)\n";
echo "</td><td>";
echo "<select size=1 name=BAT_INT>";
echo "<option value=$BAT_INT selected>$BAT_INT";
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 "<option value=300>300";
echo "<option value=360>360";
echo "<option value=420>420";
echo "<option value=480>480";
echo "</select>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "監視インターバル(2)\n";
echo "</td><td>";
echo "<select size=1 name=BAT2_INT>";
echo "<option value=$BAT2_INT selected>$BAT2_INT";
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 "<option value=300>300";
echo "<option value=360>360";
echo "<option value=480>480";
echo "</select>";
echo "</td></tr>";

echo "<tr><td>";
echo "疎通監視インターバル\n";
echo "</td><td>";
echo "<select size=1 name=LIFE_INT>";
echo "<option value=$LIFE_INT selected>$LIFE_INT";
echo "<option value=15>15";
echo "<option value=20>20";
echo "<option value=30>30";
echo "<option value=60>60";
echo "<option value=70>70";
echo "<option value=80>80";
echo "<option value=90>90";
echo "<option value=120>120";
echo "<option value=150>150";
echo "<option value=180>180";
echo "</select>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "疎通監視の閾値\n";
echo "</td><td>";
echo "<select size=1 name=LIFE_LOS>";
echo "<option value=$LIFE_LOS selected>$LIFE_LOS";
echo "<option value=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=8>8秒";
echo "<option value=12>12秒";
echo "<option value=15>15秒";
echo "</select>";
echo "疎通監視を使用しない場合は0を選択してください、サーバ側のタイマを停止します";
echo "</td></tr>";

echo "<tr><td>";
echo "めいるのCC\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=MAIL_CC size='60' value='$MAIL_CC'>";
echo "</td></tr>";

echo "<tr bgcolor='#D9DBED'><td>";
echo "UPDATE用コマンドのパス";
echo "</td><td>";
echo "<INPUT type='text' NAME=UPDATE_COM size='100' value='$UPDATE_COM'>";
echo "</td></tr>";





echo "<tr bgcolor='#D999ED'><td>";
echo "thread max";
echo "</td><td>";
echo "<select size=1 name=THREAD_MAX>";
echo "<option value=$THREAD_MAX selected>$THREAD_MAX";
echo "<option value=64>64";
echo "<option value=128>128";
echo "<option value=256>256";
echo "<option value=512>512";
echo "<option value=1024>1024";
echo "<option value=2048>2048";
echo "</select>";
echo "同時に動作するブロックの最大数です";
echo "</td></tr>";


echo "<tr bgcolor='#D999ED'><td>";
echo "tbuf max";
echo "</td><td>";
echo "<select size=1 name=TBUF_MAX>";
echo "<option value=$TBUF_MAX selected>$TBUF_MAX";
echo "<option value=64>64";
echo "<option value=128>128";
echo "<option value=256>256";
echo "</select>";
echo "一つのブロック内で処理出来る行数";
echo "</td></tr>";


echo "<tr bgcolor='#D999ED'><td>";
echo "life on or off";
echo "</td><td>";
echo "<select size=1 name=LIFE_ONOFF>";
echo "<option value=$LIFE_ONOFF selected>$LIFE_ONOFF";
echo "<option value=1>1";
echo "<option value=0>0";
echo "</select>";
echo "疎通監視を行うかどうか？";
echo "</td></tr>";


echo "<tr bgcolor='#D999ED'><td>";
echo "mid max";
echo "</td><td>";
echo "<select size=1 name=MID_MAX>";
echo "<option value=$MID_MAX selected>$MID_MAX";
echo "<option value=64>64";
echo "<option value=128>128";
echo "<option value=256>256";
echo "<option value=512>521";
echo "<option value=1024>1024";
echo "<option value=2048>2048";
echo "</select>";
echo "間欠送信を使うブロックの最大数";
echo "</td></tr>";



echo "<tr bgcolor='#D999ED'><td>";
echo "thread len";
echo "</td><td>";
echo "<select size=1 name=THREAD_LEN>";
echo "<option value=$THREAD_LEN selected>$THREAD_LEN";
echo "<option value=1>1";
echo "<option value=2>2";
echo "<option value=3>3";
echo "<option value=5>5";
echo "<option value=8>8";
echo "<option value=10>10";
echo "<option value=15>15";
echo "</select>";
echo "同時に動作出来るスレッドの数です";
echo "</td></tr>";


echo "<tr bgcolor='#D999ED'><td>";
echo "mid int";
echo "</td><td>";
echo "<select size=1 name=MID_INT>";
echo "<option value=$MID_INT selected>$MID_INT";
echo "<option value=128>128";
echo "<option value=256>256";
echo "<option value=300>300";
echo "<option value=600>600";
echo "</select>";
echo "MIDリストファイルの自動生成インターバル";
echo "</td></tr>";


echo "<tr bgcolor='#D999ED'><td>";
echo "DNS IP\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=DNS_IP size='64' value='$DNS_IP'>";
echo "</td></tr>";

echo "<tr bgcolor='#D999ED'><td>";
echo "DNS IP2\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=DNS_IP2 size='64' value='$DNS_IP2'>";
echo "</td></tr>";


echo "<tr bgcolor='#D999ED'><td>";
echo "midump_filename\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=MIDUMP_FILE size='64' value='$MIDUMP_FILE'>";
echo "</td></tr>";

echo "<tr bgcolor='#D999ED'><td>";
echo "midump_filename2\n";
echo "</td><td>";
echo "<INPUT type='text' NAME=MIDUMP_FILE_2 size='64' value='$MIDUMP_FILE_2'>";
echo "</td></tr>";




echo "<INPUT type='hidden' NAME=GEN value='taro'>";
echo "<INPUT type='hidden' NAME=EDIT value='$EDIT'>";

echo"</table>";

echo "<BR><BR>";


if(0 == strcmp($EDIT, "UPNEW")){

   echo "<font color=red>";
   print("クライアントの複製を作ります、すでにクライアント名が存在する場合は成功しません。\n");
   echo "</font>";

   echo "<TABLE cellspacing=0 nowrap border=0 WIDTH='750' height='20'BGCOLOR='#e6e8fa'>";
   echo "<tr>";
   echo "<td>";
   echo "<input type=submit value='複製を作成します'>";
   echo "</td>";
   echo "</tr>";
   echo"</table>";
   }
else{
   echo "<TABLE cellspacing=0 nowrap border=0 WIDTH='750' height='20'BGCOLOR='#e6e8fa'>";

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

   echo "<tr>";
   echo "<td>";
   echo "<input type=submit value='監視クライアントの再起動'>";
   echo "</td>";
   echo "</tr>";
   echo"</table>";
   }

echo "</form>";


print("</font>");

?>

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


