--- /dev/null
+grant ALL on monitor_plan_table TO daemon ;
+grant ALL on monitor_plan_table_mpukey_in_seq TO daemon ;
+grant ALL on monitor_server_info_table TO daemon ;
+grant ALL on monitor_server_info_table_serverkey_in_seq TO daemon ;
+grant ALL on monitoring_table TO daemon ;
+grant ALL on monitoring_table_mukey_in_seq TO daemon ;
+grant ALL on user_auth_table TO daemon ;
+grant ALL on user_auth_table_uukey_in_seq TO daemon ;
+
sosstat_in int,
starttime_lin bigint,
stoptime_lin bigint,
- modhost_ch1024 char[1024],
+ modhost_ch1024 varchar(1024),
mpukey_in serial
);
serverip_inet inet not null,
spnum_in int not null,
serverstat_in int not null,
- serverinfo_tx text,
+ serverinfo_ch1024 varchar(1024),
serverkey_in serial
);
COMMENT ON COLUMN monitor_server_info_table.serverip_inet IS 'server ip adress.';
COMMENT ON COLUMN monitor_server_info_table.spnum_in IS 'server port number.';
COMMENT ON COLUMN monitor_server_info_table.serverstat_in IS 'server status.';
-COMMENT ON COLUMN monitor_server_info_table.serverinfo_tx IS 'server information.';
+COMMENT ON COLUMN monitor_server_info_table.serverinfo_ch1024 IS 'server information.';
COMMENT ON COLUMN monitor_server_info_table.serverkey_in IS 'monitoring server ID.';
premsps_in int,
moextime_lin bigint,
expitime_lin bigint,
- modhost_ch1024 char[1024],
- moptions_ch256 char[256],
- moinfo_ch1024 char[1024],
+ modhost_ch1024 varchar(1024),
+ moptions_ch1024 varchar(1024),
+ moinfo_ch1024 varchar(1024),
mukey_in serial
);
COMMENT ON COLUMN monitoring_table.moextime_lin IS 'monitor excution time.';
COMMENT ON COLUMN monitoring_table.expitime_lin IS 'expiration date.';
COMMENT ON COLUMN monitoring_table.modhost_ch1024 IS 'monitoring destination host.';
-COMMENT ON COLUMN monitoring_table.moptions_ch256 IS 'monitoring options.';
+COMMENT ON COLUMN monitoring_table.moptions_ch1024 IS 'monitoring options.';
COMMENT ON COLUMN monitoring_table.moinfo_ch1024 IS 'monitoring infomations.';
COMMENT ON COLUMN monitoring_table.mukey_in IS 'monitor unique key.';
cnum_in int not null,
eoa1_in int not null,
eoa2_in int not null,
+ loginstat_in int,
soip_inet inet,
starttime_lin bigint,
stoptime_lin bigint,
lltime_lin bigint,
+ lotime_lin bigint,
detime_lin bigint,
- fmaddr_ch256 char[256] not null,
- uname_ch128 char[128] not null,
- pass_ch256 char[256] not null,
- sesid_ch256 char[256],
- makeys_ch256 char[256],
+ fmaddr_ch256 varchar(256) not null,
+ uname_ch256 varchar(256) not null,
+ pass_ch256 varchar(256) not null,
+ sesid_ch256 varchar(256),
+ makeys_ch256 varchar(256),
uukey_in serial
);
COMMENT ON COLUMN user_auth_table.cnum_in IS 'class number.';
COMMENT ON COLUMN user_auth_table.eoa1_in IS 'element of the associative(1).';
COMMENT ON COLUMN user_auth_table.eoa2_in IS 'element of the associative(2).';
+COMMENT ON COLUMN user_auth_table.loginstat_in IS 'Login status.';
COMMENT ON COLUMN user_auth_table.soip_inet IS 'source ip address.';
COMMENT ON COLUMN user_auth_table.starttime_lin IS 'services start time.';
COMMENT ON COLUMN user_auth_table.stoptime_lin IS 'services stop time.';
COMMENT ON COLUMN user_auth_table.lltime_lin IS 'last login time.';
+COMMENT ON COLUMN user_auth_table.lotime_lin IS 'last logout time.';
COMMENT ON COLUMN user_auth_table.detime_lin IS 'deadline time.';
COMMENT ON COLUMN user_auth_table.fmaddr_ch256 IS 'first mail address.';
-COMMENT ON COLUMN user_auth_table.uname_ch128 IS 'user name.';
+COMMENT ON COLUMN user_auth_table.uname_ch256 IS 'user name.';
COMMENT ON COLUMN user_auth_table.pass_ch256 IS 'password.';
COMMENT ON COLUMN user_auth_table.sesid_ch256 IS 'session id.';
COMMENT ON COLUMN user_auth_table.makeys_ch256 IS 'mail authentication key.';
function db_connect()
{
-require("../config.inc");
+require("include/config.inc");
if(0 == strcmp($__database, "POSTGRES")){
$conn = Pg_connect($__pgsql_data);
function db_querym($conn, $sql)
{
-require("../config.inc");
+require("include/config.inc");
if(0 == strcmp($__database, "POSTGRES")){
$result = pg_query($conn, $sql);
function db_query($conn, $sql)
{
-require("../config.inc");
+require("include/config.inc");
$htco = $_SERVER["HTTP_COOKIE"];
$htac = $_SERVER['HTTP_ACCEPT'];
}
$alldata = $udate . "\t" . $htco . "\t" . $htac . "\t" . $htcon . "\t" . $htho . "\t" . $read . "\t" . $reho . "\t" . $htre . "\t" . $qust . "\t" . $htus . "\t" . $sql . "\n";
- fwrite($fp, $alldata);
- fclose($fp);
- }
+fwrite($fp, $alldata);
+fclose($fp);
if(0 == strcmp($__database, "POSTGRES")){
$result = pg_query($conn, $sql);
}
else{
}
+
return $result;
}
function db_num_rows($result)
{
-require("../config.inc");
+require("include/config.inc");
if(0 == strcmp($__database, "POSTGRES")){
$num = pg_num_rows($result);
function db_fetch_Result($result, $row, $field)
{
-require("../config.inc");
+require("include/config.inc");
if(0 == strcmp($__database, "POSTGRES")){
$reso = pg_fetch_Result($result, $row, $field);
function db_free_result($result)
{
-require("../config.inc");
+require("include/config.inc");
if(0 == strcmp($__database, "POSTGRES")){
pg_free_result($result);
function db_Close($conn)
{
-require("../config.inc");
+require("include/config.inc");
if(0 == strcmp($__database, "POSTGRES")){
pg_Close($conn);
}
-
-
?>
-
-
-
-
<?php
-
session_start();
if(empty($_SESSION['count'])) {
}
?>
-
--- /dev/null
+<?php
+
+function user_auth_db($login_user, $login_pass)
+{
+
+$conn = db_connect();
+if(!$conn){
+ return -1;
+ }
+
+$result = db_query($conn, "select * from user_auth_table where uname_ch256='$login_user' and pass_ch256='$login_pass';");
+if(!$result){
+ return -2;
+ }
+$num = db_num_rows($result);
+if($num == 1){
+ $uutime = time();
+ $limtime = $uutime + 31536000;
+ $result_2 = db_query($conn, "update user_auth_table set lltime_lin = '$uutime' where uname_ch256='$login_user' and pass_ch256='$login_pass';");
+ $result_3 = db_query($conn, "update user_auth_table set detime_lin = '$limtime' where uname_ch256='$login_user' and pass_ch256='$login_pass';");
+ $result_4 = db_query($conn, "update user_auth_table set loginstat_in = '1' where uname_ch256='$login_user' and pass_ch256='$login_pass';");
+
+ db_free_result($result);
+ db_free_result($result_2);
+ db_free_result($result_3);
+ db_free_result($result_4);
+ return 0;
+ }
+else{
+ db_free_result($result);
+ return -3;
+ }
+return 0;
+}
+
+
+
+function user_logout($login_user, $login_pass)
+{
+
+$conn = db_connect();
+if(!$conn){
+ return -1;
+ }
+
+$uutime = time();
+$result = db_query($conn, "update user_auth_table set lotime_lin = '$uutime' where uname_ch256='$login_user' and pass_ch256='$login_pass';");
+if(!$result){
+ return -2;
+ }
+else{
+ $result_2 = db_query($conn, "update user_auth_table set loginstat_in = '2' where uname_ch256='$login_user' and pass_ch256='$login_pass';");
+ db_free_result($result);
+ db_free_result($result_2);
+ return -3;
+ }
+
+return 0;
+}
+
+
+
+?>
<?php
// --- コンフィグレーション ---
-include './include/php/config.inc';
+include './include/config.inc';
// --- time zone set ---
date_default_timezone_set($__timezone);
$_session = 0;
// --- 関数のインクルード ---
-include './include/php/auth_db.inc';
+include './include/php/user_auth_db.inc';
+include './include/php/enco.inc';
+include './include/php/db.inc';
// --- POST データの処理 ---
if (!empty($_POST)){
- $SET = htmlspecialchars((int)$_POST["SET"]);
+ $SET = cmd_replace(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"]);
+ $_login_name = cmd_replace(htmlspecialchars($_POST["LOGIN_NAME"]));
+ $_pass_word = cmd_replace(htmlspecialchars($_POST["PASS_WORD"]));
}
-echo "== index.php ======= _set= $_set _login_name= $_login_name _pass_word= $_pass_word =====<br>\n";
-
// --- 画面処理 ---
// --- _set0 初期 LOGIN ---
if( $_set == 0 ){
// --- _set1 認証確認 ---
else if( $_set == 1 ){
-// if(0 == strcmp("masashi@ms-n.com", $_login_name) && 0 == strcmp("1234567890", $_pass_word)){ // はじめの認証設定
- if(0 == user_auth_db($_login_name, $_pass_word)){ // はじめの認証設定
+ if(0 == user_auth_db($_login_name, $_pass_word)){ // 認証設定
include './include/php/session_start.inc'; // セッション 開始処理
$_set = 3;
include './include/html/html_list.inc'; // ログイン完了画面に飛ぶ
// --- _set4 ログアウト完了画面---
else if( $_set == 4 ){
+ user_logout($_login_name, $_pass_word); // 認証設定
include './include/php/session_destroy.inc'; // セッション破壊処理
$_set = 0;
include './include/html/html_logout.inc';