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


session_start();
require("./ninsyou.inc");
if(0 > ninsyou_check(3)){
   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>";

echo "</head>";
echo "<body alink='#ff0000' bgcolor='#ffffff' link='#0000ff' text='#0000' vlink='#0080'>";

echo "<pre>";

$COME = enco($_GET["COME"]);
$CNAME = enco($_GET["CNAME"]);
$MONITOR = enco($_GET["MONITOR"]);
$SIGN = enco($_GET["SIGN"]);
$PROTO = enco($_GET["PROTO"]);
$COM = enco($_GET["COM"]);
$CIP = enco($_GET["CIP"]);
$PORT = enco($_GET["PORT"]);
$WTIME = enco($_GET["WTIME"]);
$PINFO = enco($_GET["PINFO"]);
$PRINO = enco($_GET["PRINO"]);
$FREE1 = enco($_GET["FREE1"]);
$FREE2 = enco($_GET["FREE2"]);
$FREE3 = enco($_GET["FREE3"]);
$FREE4 = enco($_GET["FREE4"]);
$GEN = enco($_GET["GEN"]);

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

if(0 == strlen($CNAME)){
   print("NOT hostname");
   exit;
   }

print($version_name);
print("\n");
print(date("Y m d g i s A"));
print("\n");



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

if(0 < $MAX){
   $count = 0;
   $result=db_query($conn,"select cname from monitor where free4='$FREE4';");
   if(!$result){
      print("canem select , bud query\n");
      exit;
      }
   $maxnum = db_num_rows($result);
   if($maxnum >= $MAX){
      print("MAX $MAX \n");
      exit;
      }

   db_free_result($result);
   }


$CNAME = cname_return($FREE4);
if(0 >= strlen($CNAME)){
   echo "not cname return!<br>";
   exit;
   }

$result = db_query($conn, "insert into monitor
  (
  come,
  cname,
  monitor,
  sign,
  proto,
  com,
  cip,
  port,
  wtime,
  pinfo,
  prino,
  free1,
  free2,
  free3,
  free4
  ) values (
 '$COME',
 '$CNAME',
 '$MONITOR',
 $SIGN,
 '$PROTO',
 '$COM',
 '$CIP',
 '$PORT',
 $WTIME,
 '$PINFO',
 $PRINO,
 '$FREE1',
 '$FREE2',
 '$FREE3',
 '$FREE4')
 ");

if(!$result){
   print("bud query set\n");
   exit;
   }

// --- print data ---- //
echo "OK Inser data\n";
echo "$COME\n";
echo "$CNAME\n";
echo "$MONITOR\n";
echo "$SIGN\n";
echo "$PROTO\n";
echo "$COM\n";
echo "$CIP\n";
echo "$PORT\n";
echo "$WTIME\n";
echo "$PINFO\n";
echo "$PRINO\n";
echo "$FREE1\n";
echo "$FREE2\n";
echo "$FREE3\n";
echo "$FREE4\n";


// --- list file upload --- // 

list_file_upload($CNAME, $GEN);


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

?>

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

