OSDN Git Service

ds-apollon addid 20140218
authormasashi <masashi@home.ms-n.com>
Tue, 18 Feb 2014 02:36:45 +0000 (11:36 +0900)
committermasashi <masashi@home.ms-n.com>
Tue, 18 Feb 2014 02:36:45 +0000 (11:36 +0900)
12 files changed:
Changes
ds-apollon/common.css [new file with mode: 0644]
ds-apollon/include/html/html_edit.inc [new file with mode: 0644]
ds-apollon/include/html/html_list.inc [new file with mode: 0644]
ds-apollon/include/html/html_login1.inc [new file with mode: 0644]
ds-apollon/include/html/html_login2.inc [new file with mode: 0644]
ds-apollon/include/html/html_logout.inc [new file with mode: 0644]
ds-apollon/include/php/db/enco.inc [new file with mode: 0644]
ds-apollon/include/php/session_check.inc [new file with mode: 0644]
ds-apollon/include/php/session_destroy.inc [new file with mode: 0644]
ds-apollon/include/php/session_start.inc [new file with mode: 0644]
ds-apollon/index.php [new file with mode: 0644]

diff --git a/Changes b/Changes
index 46ea106..262ec8f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,11 +3,21 @@ Changes with ds-zither
 
   *) PROJECT START: 2014-02-10-0
      I have committed for Changes file for ds-zither project.
-     PR: masashi@ms-n.com (sendan)
+     R: masashi@ms-n.com (sendan)
 
   *) database table update: 2014-02-11-0
      I decided the specifications in the database table below.
      monitor_plan.sql,monitor_server_info.sql,monitoring.sql,user_auth.sql
-     PR: masashi@ms-n.com (sendan)
+     R: masashi@ms-n.com (sendan)
+
+  *) database table update: 2014-02-14-0
+     I have added a comment line in the table.
+     monitor_plan.sql,monitor_server_info.sql,monitoring.sql,user_auth.sql
+     R: masashi@ms-n.com (sendan)
+
+  *) User Interface Update: 2014-02-18-0
+     I added the holder of ds-apollon.
+     R: masashi@ms-n.com (sendan)
+
 
 
diff --git a/ds-apollon/common.css b/ds-apollon/common.css
new file mode 100644 (file)
index 0000000..bb16e44
--- /dev/null
@@ -0,0 +1,110 @@
+/* masashi shimakura 2013/09/15  */
+
+html { margin: 0em 0em; padding 0em 0em; background: #eeeeee none; }
+
+body { margin: 2em 2em; padding 0em 0em;
+  background: #eeeeee none; color: #111111;
+  font-style: normal; font-weight: normal; }
+
+h1 { margin-top: 1.8em; margin-bottom: 1.3em; font-weight: bold; }
+
+h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold;
+  border-left: solid 1.3em #005555; border-bottom: solid 1pt #bbbbbb;
+  padding: 0.5em 0.5em; width: 50%; }
+
+h3 { margin-top: 1.8em; margin-bottom: 0.5em; font-weight: bold;
+  border-left: solid 0.7em #005555; border-bottom: solid 1pt #bbbbbb;
+  padding: 0.5em 0.5em; width: 50%; }
+
+h4 { margin-top: 1.0em; margin-bottom: 0.1em; font-weight: bold;
+  border-left: solid 0.3em #005555; border-bottom: solid 1pt #bbbbbb;
+  padding: 0.2em 0.2em; width: 30%; }
+
+
+
+hr { margin-top: 2.5em; margin-bottom: 1.5em; height: 1pt;
+  color: #999999; background-color: #999999; border: none; }
+
+div.note,div.navi { text-align: right; margin-right: 0em; }
+
+div.logo { text-align: center; margin: 3em 0em; }
+
+div.logo img { border: inset 2pt #ccccdd; }
+
+div.illust { margin: 1em 0em; text-align: center; }
+
+div.illust img { border: solid 1pt #ccccdd; }
+
+p { margin: 0.8em 0em; line-height: 140%; }
+
+p,dd { text-indent: 0.8em; }
+
+div,pre { margin-left: 1.7em; margin-right: 1.7em; }
+
+pre { background-color: #ddddee; padding: 0.2em; border: 1pt solid #bbbbcc; font-size: smaller; }
+
+strong { font-style: normal; font-weight: bold; color: #000000; }
+
+code { font-style: normal; font-weight: normal; color: #000000; }
+
+kbd { font-style: normal; font-weight: bold; color: #000000; }
+
+a { color: #0022aa; text-decoration: none; }
+
+a:hover,a:focus { color: #0033ee; text-decoration: underline; }
+
+a.head { color: #111111; text-decoration: none; }
+
+span.void { color: #888888; }
+
+table { padding: 1pt 2pt 1pt 2pt; border: none; margin-left: 1.7em; border-collapse: collapse; }
+
+th { padding: 1pt 4pt 1pt 4pt; border-style: none;
+  text-align: left; vertical-align: bottom; }
+
+th.mini { font-size: smaller; }
+
+td { padding: 1pt 4pt 1pt 4pt; border: 1pt solid #333333;
+  text-align: left; vertical-align: top; }
+
+td.mini { font-size: smaller; }
+
+ul,ol,dl { line-height: 140%; }
+
+dt { margin-left: 1.1em; }
+
+dd { margin-left: 1.8em; }
+
+ul.lines { list-style-type: none; }
+
+span.word { text-decoration: underline; margin: 0em 0.1em; }
+
+@media print {
+  html,body { margin: 0em 0em; background-color: #ffffff; color: #000000; }
+
+  h1 { padding: 8em 0em 0.5em 0em; text-align: center; }
+
+  h2 { page-break-before: always; }
+
+  div.note { text-align: center; }
+
+  div.navi,div.logo { display: none }
+
+  hr { display: none; }
+
+  pre { margin: 0.8em 0.8em; background-color: #ffffff;
+    border: 1pt solid #aaaaaa; font-size: smaller; }
+
+  a,kbd { color: #000000; text-decoration: none; }
+
+  h1,h2,h3 { font-family: sans-serif; }
+
+  p,div,li,dt,dd { font-family: serif; }
+
+  pre,kbd { font-family: monospace; }
+
+  dd { font-size: smaller; }
+}
+
+/* END OF FILE */
+
diff --git a/ds-apollon/include/html/html_edit.inc b/ds-apollon/include/html/html_edit.inc
new file mode 100644 (file)
index 0000000..84c7be5
--- /dev/null
@@ -0,0 +1,34 @@
+
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+<link rel='stylesheet' href='common.css'/>
+<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
+
+</HEAD>
+<BODY>
+<h3> 編集画面です </h3>
+<FORM METHOD=post ACTION=./index.php>
+<TABLE border=0  WIDTH=80% height=1%>
+
+<INPUT type=hidden size=24 name=LOGIN_NAME value='<?php echo $login_name; ?>'>
+<INPUT type=hidden size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'>
+<INPUT type=hidden size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'>
+
+<tr>
+<td>画面選択</td><td> 
+  <select name=SET>
+    <option value=5 selected>編集画面</option>
+    <option value=3>閲覧画面</option>
+    <option value=4>ログアウト</option>
+  </select> </td>
+</tr>
+<tr>
+<td>送信</td><td> <INPUT TYPE=SUBMIT value=submit></td>
+</tr>
+
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/ds-apollon/include/html/html_list.inc b/ds-apollon/include/html/html_list.inc
new file mode 100644 (file)
index 0000000..05c85ca
--- /dev/null
@@ -0,0 +1,34 @@
+
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+<link rel='stylesheet' href='common.css'/>
+<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
+
+</HEAD>
+<BODY>
+<h3> 閲覧画面 </h3>
+<FORM METHOD=post ACTION=./index.php>
+<TABLE border=0  WIDTH=80% height=1%>
+
+<INPUT type=hidden size=24 name=LOGIN_NAME value='<?php echo $login_name; ?>'>
+<INPUT type=hidden size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'>
+<INPUT type=hidden size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'>
+
+<tr>
+<td>画面選択</td><td> 
+  <select name=SET>
+    <option value=3 selected>閲覧画面</option>
+    <option value=5>編集画面</option>
+    <option value=4>ログアウト</option>
+  </select> </td>
+</tr>
+<tr>
+<td>送信</td><td> <INPUT TYPE=SUBMIT value=submit></td>
+</tr>
+
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/ds-apollon/include/html/html_login1.inc b/ds-apollon/include/html/html_login1.inc
new file mode 100644 (file)
index 0000000..80ac1e0
--- /dev/null
@@ -0,0 +1,27 @@
+
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+<link rel='stylesheet' href='common.css'/>
+<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
+</HEAD>
+<BODY>
+<h3> パスワードとログインIDがを入れて下さい </h3>
+<FORM METHOD=post ACTION=./index.php>
+<TABLE border=0  WIDTH=80% height=1%>
+<tr>
+<td>LOGIN NAME</td><td> <INPUT type=text size=24 name=LOGIN_NAME value='<?php echo $login_name; ?>'></td>
+</tr>
+<tr>
+<td>PASS WORD</td><td> <INPUT type=hidden name=SET value=<?php echo $set; ?>>
+<INPUT type=password size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'></td>
+</tr>
+<tr>
+<td>SUBMIT</td><td> <INPUT TYPE=SUBMIT value=submit></td>
+</tr>
+
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/ds-apollon/include/html/html_login2.inc b/ds-apollon/include/html/html_login2.inc
new file mode 100644 (file)
index 0000000..4e64ba7
--- /dev/null
@@ -0,0 +1,26 @@
+
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+<link rel='stylesheet' href='common.css'/>
+<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
+</HEAD>
+<BODY>
+<h3> パスワードかログインIDが間違いですよ </h3>
+<FORM METHOD=post ACTION=./index.php>
+<TABLE border=0  WIDTH=80% height=1%>
+<tr>
+<td>LOGIN NAME</td><td> <INPUT type=text size=24 name=LOGIN_NAME value='<?php echo $login_name; ?>'></td>
+</tr>
+<tr>
+<td>PASS WORD</td><td> <INPUT type=hidden name=SET value=<?php echo $set; ?>><INPUT type=password size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'></td>
+</tr>
+<tr>
+<td>SUBMIT</td><td> <INPUT TYPE=SUBMIT value=submit></td>
+</tr>
+
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/ds-apollon/include/html/html_logout.inc b/ds-apollon/include/html/html_logout.inc
new file mode 100644 (file)
index 0000000..034f52d
--- /dev/null
@@ -0,0 +1,26 @@
+
+<HTML>
+<HEAD>
+<TITLE></TITLE>
+<link rel='stylesheet' href='common.css'/>
+<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
+
+</HEAD>
+<BODY>
+<h3> ログアウトしました!お疲れ様です </h3>
+<FORM METHOD=post ACTION=./index.php>
+<TABLE border=0  WIDTH=80% height=1%>
+
+<INPUT type=hidden size=24 name=LOGIN_NAME value='<?php echo $login_name; ?>'>
+<INPUT type=hidden name=SET value=<?php echo $set; ?>>
+<INPUT type=hidden size=24 name=PASS_WORD value='<?php echo $pass_word; ?>'>
+
+<tr>
+<td>ログインに戻る</td><td> <INPUT TYPE=SUBMIT value=submit></td>
+</tr>
+
+</TABLE>
+</BODY>
+</HTML>
+
+
diff --git a/ds-apollon/include/php/db/enco.inc b/ds-apollon/include/php/db/enco.inc
new file mode 100644 (file)
index 0000000..e0178b1
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+function enco($data)
+{
+$data = mb_convert_encoding($data, "UTF-8", "auto");
+return($data);
+}
+
+
+function cmd_replace($data)
+{
+$data = enco($data);
+
+$data = str_replace("#", "", $data);
+$data = str_replace(";", "", $data);
+$data = str_replace("'", "", $data);
+$data = str_replace("`", "", $data);
+$data = str_replace("|", "", $data);
+$data = str_replace("*", "", $data);
+$data = str_replace("<", "", $data);
+$data = str_replace(">", "", $data);
+$data = str_replace("^", "", $data);
+$data = str_replace("(", "", $data);
+$data = str_replace(")", "", $data);
+$data = str_replace("[", "", $data);
+$data = str_replace("]", "", $data);
+$data = str_replace("{", "", $data);
+$data = str_replace("}", "", $data);
+$data = str_replace("$", "", $data);
+$data = str_replace(",", "", $data);
+$data = str_replace("\"", "", $data);
+$data = str_replace("\x0A", "", $data);
+$data = str_replace("\xFF", "", $data);
+$data = str_replace("\\", "", $data);
+
+$data = escapeshellcmd($data);
+$data = pg_escape_string($data);
+
+$data = str_replace("\\\?", "?", $data);
+$data = str_replace("\\\~", "~", $data);
+$data = str_replace("\\\&", "&", $data);
+
+return $data;
+
+}
+
+
+?>
diff --git a/ds-apollon/include/php/session_check.inc b/ds-apollon/include/php/session_check.inc
new file mode 100644 (file)
index 0000000..d71fdab
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+session_start();
+
+if(empty($_SESSION['count'])) {
+   $_session = 0;
+
+   printf("------ warning session check = count is empty-----<br>\n");
+   printf("------ start session md5 %s -------<br>\n", $_SESSION['session_data']);
+
+   }
+else{
+   $seed = $login_name . $pass_word . $_SESSION['session_time']; 
+   if(0 == strcmp($_SESSION['session_data'], md5($seed))){
+      $_SESSION['count']++;
+      $_session = 1;
+      }
+   else{
+      printf("------ warning session check = session data is differ -----<br>\n");
+      $_session = 0;
+      }
+
+   $nowtime = time();
+   $difftime = $nowtime - $_SESSION['session_time'];
+   if($difftime < 3600 ){
+      $_SESSION['count']++;
+      $_session = 1;
+      }
+   else{
+      printf("------ warning session check = session timed out -----<br>\n");
+      $_session = 0;
+      }
+
+   printf("======= check session count %s ========<br>\n", $_SESSION['count']);
+   printf("======= check session md5 OK %s ========<br>\n", $_SESSION['session_data']);
+   printf("======= check mow md5 OK %s ========<br>\n", md5($seed));
+   printf("======= check now time %s session start time %s  diff= %s =====<br>\n", $nowtime, $_SESSION['session_time'], $difftime);
+   printf("======= check session _session OK %s ========<br>\n", $_session);
+   }
+
+?>
+
diff --git a/ds-apollon/include/php/session_destroy.inc b/ds-apollon/include/php/session_destroy.inc
new file mode 100644 (file)
index 0000000..8c6f760
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+session_start();
+
+// セッション変数を全て解除する
+$_SESSION = array();
+
+// セッションを切断するにはセッションクッキーも削除する。
+// Note: セッション情報だけでなくセッションを破壊する。
+if (ini_get("session.use_cookies")) {
+    $params = session_get_cookie_params();
+    setcookie(session_name(), '', time() - 42000,
+        $params["path"], $params["domain"],
+        $params["secure"], $params["httponly"]
+    );
+}
+
+// 最終的に、セッションを破壊する
+session_destroy();
+
+$_session = 0;
+printf("========== session destroy ======\n");
+
+?>
+
diff --git a/ds-apollon/include/php/session_start.inc b/ds-apollon/include/php/session_start.inc
new file mode 100644 (file)
index 0000000..56d8eb0
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+session_start();
+
+if(empty($_SESSION['count'])) {
+
+   $_SESSION['session_time'] = time();
+   $seed = $login_name . $pass_word . $_SESSION['session_time']; 
+   $_SESSION['session_data'] = md5($seed);
+
+   $_SESSION['count'] = 1;
+   $_session = 1;
+
+   printf("------ start session md5 %s -------<br>\n", $_SESSION['session_data']);
+   printf("------ start session time %s start -----<br>\n", $_SESSION['session_time']);
+
+   }
+else{
+   $_session = 0;
+   printf("======= check session count %s ========<br>\n", $_SESSION['count']);
+   printf("======= check session md5 OK %s ========<br>\n", $_SESSION['session_data']);
+   printf("======= check session _session OK %s ========<br>\n", $_session);
+   }
+
+?>
+
diff --git a/ds-apollon/index.php b/ds-apollon/index.php
new file mode 100644 (file)
index 0000000..ceddbff
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+
+// --- グローバル変数設定 ---
+date_default_timezone_set('Asia/Tokyo');
+$set = 0;
+$login_name ="";
+$pass_word ="";
+$_session = 0;
+
+// --- POST データの処理 ---
+if (!empty($_POST)){
+   $SET = htmlspecialchars((int)$_POST["SET"]);
+   if(preg_match("/^[0-9]+$/", $SET)){ $set = $SET; } else{ $set = 0; }
+
+   $login_name = htmlspecialchars($_POST["LOGIN_NAME"]);
+   $pass_word = htmlspecialchars($_POST["PASS_WORD"]);
+   }
+
+
+echo "== index.php ======= set= $set login_name= $login_name pass_word= $pass_word =====<br>\n";
+
+// --- 画面処理 ---
+// --- set0 初期 LOGIN ---
+if( $set == 0 ){
+   $set = 1;
+   include './include/html/html_login1.inc';                     // ログイン画面に飛ぶ
+   }
+
+// --- set1 認証確認 ---
+else if( $set == 1 ){
+   if(0 == strcmp("masashi@ms-n.com", $login_name) && 0 == strcmp("yukiko1919", $pass_word)){    // はじめの認証設定
+      include './include/php/session_start.inc';                // セッション 開始処理
+      $set = 3;
+      include './include/html/html_list.inc';                   // ログイン完了画面に飛ぶ
+      }
+   else{
+      $set = 1;
+      include './include/html/html_login2.inc';                  // ログイン失敗後の再ログイン画面に飛ぶ
+      }
+   }
+
+// --- set2 ログイン失敗後の再ログイン画面  ---
+else if( $set == 2 ){
+   $set = 1;
+   include './include/html/html_login2.inc';                  // ログイン失敗後の再ログイン画面に飛ぶ
+   }
+
+// --- set3 ログイン完了画面 (一覧画面) --- 
+else if( $set == 3 ){
+   include './include/php/session_check.inc';                // セッション 確認処理
+   if($_session == 1){
+      $set = 3;
+      include './include/html/html_list.inc';
+      }
+   else{
+      $set = 1;
+      include './include/html/html_login1.inc';                // ログイン画面に飛ぶ
+      }
+   }
+
+// --- set4 ログアウト完了画面---
+else if( $set == 4 ){
+   include './include/php/session_destroy.inc';               // セッション破壊処理
+   $set = 0;
+   include './include/html/html_logout.inc';
+   }
+
+// --- set5 ログイン完了画面 (編集画面)--- 
+else if( $set == 5 ){
+   include './include/php/session_check.inc';                // セッション 確認処理
+   if($_session == 1){
+      $set = 5;
+      include './include/html/html_edit.inc';
+      }
+   else{
+      $set = 1;
+      include './include/html/html_login1.inc';                // ログイン画面に飛ぶ
+      }
+   }
+
+// ---  それら以外の処理画面 
+else{
+   include './include/php/session_destroy.inc';                 // セッション破壊処理
+   $set = 1;
+   include './include/html/html_login1.inc';                     // ログイン画面に飛ぶ
+   }
+
+
+?>
+
+
+