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


$view_mode = enco($_GET["VIEW_MODE"]);
$view_name = enco($_GET["VIEW_NAME"]);

$cname = enco($_GET["CNAME"]);
$free4 = enco($_GET["FREE4"]);
$ye = enco($_GET["YE"]);
$monitor = enco($_GET["MONITOR"]);
$proto = enco($_GET["PROTO"]);
$prino = enco($_GET["PRINO"]);
$port = enco($_GET["PORT"]);
$by = enco($_GET["BY"]);

$ye_ch = enco($_GET["YE_CH"]);
$monitor_ch = enco($_GET["MONITOR_CH"]);
$proto_ch = enco($_GET["PROTO_CH"]);
$prino_ch = enco($_GET["PRINO_CH"]);
$port_ch = enco($_GET["PORT_CH"]);

$ncol1 = "bgcolor=#f0f0d2";
$ncol2 = "bgcolor=#d2f0f0";
$acol1 = "bgcolor=#e0e0a0";
$acol2 = "bgcolor=#a0e0e0";
$bcol1 = "bgcolor=#f0c0c0";
$bcol2 = "bgcolor=#c0c0f0";


if(0 != strlen($cname)){
   $select_data = "select * from errlog where " . "cname = '$cname'";
   }
else{
   $select_data = "select * from errlog where " . "cname LIKE '%'";
   }

if(0 != strlen($free4)){
   $select_data = $select_data . " and free4 = '$free4'";
   }
if(0 != strlen($monitor)){
   if(0 == strcmp("on", $monitor_ch)){
      $select_data = $select_data . " and monitor != '$monitor'";
      }
   else{
      $select_data = $select_data . " and monitor='$monitor'";
      }
   }
if(0 != strlen($ye)){
   if(0 == strcmp("on", $ye_ch)){
      $select_data = $select_data . " and ye != '$ye'";
      }
   else{
      $select_data = $select_data . " and ye='$ye'";
      }
   }
if(0 != strlen($proto)){
   if(0 == strcmp("on", $proto_ch)){
      $select_data = $select_data . " and proto != '$proto'";
      }
   else{
      $select_data = $select_data . " and proto = '$proto'";
      }
   }
if(0 != strlen($port)){
   if(0 == strcmp("on", $port_ch)){
      $select_data = $select_data . " and port != '$port'";
      }
   else{
      $select_data = $select_data . " and port = '$port'";
      }
   }
if(0 != strlen($prino)){
   if(0 == strcmp("on", $prino_ch)){
      $select_data = $select_data . " and prino != '$prino'";
      }
   else{
      $select_data = $select_data . " and prino = '$prino'";
      }
   }


echo "<title>zither monitorring save info</title>";
echo "</head>";
echo "<body alink='#ff0000' bgcolor='$my_bgcolor' link='#0000ff' text='#000000' vlink='#000080'>";

echo "<pre>";

echo "<TABLE border=0 bgcolor=FFA500 cellspacing=3 cellpadding=0 width=100%>";
echo "<tr><td align=left><font color=ffffff><b>　情報 -> 月別エラー件数</b></font></td></tr>";
echo "</table><br><br>";

print("<font size=1>");
print($version_name);
print("\n");
print(date("Y m d g i s A"));
print("\n");
print($select_data);


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

echo "<TABLE border=0  WIDTH=50% height=10% BGCOLOR=$my_bocolor>";

echo "<tr bgcolor='#D9DBED'>";
echo "<td>";
print("発生月");
echo "</td>";
echo "<td>";
print("件数");
echo "</td>";
echo "<td>";

echo "</td>";
echo "</tr>";



// データ検索
for($count=1; $count < 13; $count++){

   $select_data_2 = " and mo='$count'";

   $result = db_query($conn, "$select_data$select_data_2");
   if(!$result){
      print("bud query\n");
      exit;
      }
   $num = db_num_rows($result);

   if($maxlen < $num){
      $maxlen = $num;
      }
   $rldata[$count] = $num;

   db_free_result($result);
   $num = 0;
   }





// データ検索表示
$size = $maxlen / $by;
for($count=1; $count < 13; $count++){

   echo "<tr bgcolor='#D9DBED'>";
   echo "<td>";
   print($count);
   echo "</td>";

   echo "<td>";
   print($rldata[$count]);
   echo "</td>";

   echo "<td>";

   $width_size = $rldata[$count] / $size;
   echo "<img src='../img/mag2.png' height=10 width=$width_size alt='apoimg'>";
   $width_size = 0;

   echo "</td>";
   echo "</tr>";

   }


echo "</table>";
echo "</font>";

db_Close($conn);

?>
</pre>
<br>
<br>
</body>
</html>


