• R/O
  • HTTP
  • SSH
  • HTTPS

ds-zither: コミット

this program is deadline monitor for the domain and ssl.

ds-zitherはドメインとSSL証明書の期限監視を中心に、2014年2月から0ベースで開発を開始しました。


コミットメタ情報

リビジョン033152efc3aafbb3734acfb47ab50c472cd5b8d5 (tree)
日時2014-03-01 13:35:55
作者masashi <masashi@home...>
コミッターmasashi

ログメッセージ

ds-apollon php modifide 20140301

変更サマリ

差分

--- /dev/null
+++ b/ds-apollon/include/config.inc
@@ -0,0 +1,15 @@
1+<?php
2+
3+$__timezone = "Asia/Tokyo";
4+$__database = "POSTGRES";
5+//$__database = "MYSQL";
6+$__pgsql_data = "hostaddr='127.0.0.1' port='5432' dbname='ds-zither' connect_timeout='12'";
7+//$__mysql_ip = "127.0.0.1";
8+//$__mysql_user = "masashi";
9+//$__mysql_db = "zither";
10+//$__mysql_pass = "masashi";
11+
12+$__dblogfile = "/tmp/logfile.log";
13+
14+
15+?>
--- /dev/null
+++ b/ds-apollon/include/php/db.inc
@@ -0,0 +1,182 @@
1+<?php
2+
3+
4+function db_connect()
5+{
6+require("../config.inc");
7+
8+if(0 == strcmp($__database, "POSTGRES")){
9+ $conn = Pg_connect($__pgsql_data);
10+ return $conn;
11+ }
12+else if(0 == strcmp($__database, "MYSQL")){
13+ $conn = mysql_connect($__mysql_ip, $__mysql_user, $__mysql_pass);
14+ if(!$conn){
15+ return -1;
16+ }
17+ mysql_select_db($__mysql_db, $conn);
18+ return $conn;
19+ }
20+return $conn;
21+}
22+
23+
24+
25+function db_querym($conn, $sql)
26+{
27+require("../config.inc");
28+
29+if(0 == strcmp($__database, "POSTGRES")){
30+ $result = pg_query($conn, $sql);
31+ return $result;
32+ }
33+else if(0 == strcmp($__database, "MYSQL")){
34+ $result = mysql_query($sql, $conn);
35+
36+ return $result;
37+ }
38+return $result;
39+}
40+
41+
42+
43+function db_query($conn, $sql)
44+{
45+require("../config.inc");
46+
47+$htco = $_SERVER["HTTP_COOKIE"];
48+$htac = $_SERVER['HTTP_ACCEPT'];
49+$htcon = $_SERVER['HTTP_CONNECTION'];
50+$htho = $_SERVER['HTTP_HOST'];
51+$read = $_SERVER["REMOTE_ADDR"];
52+$reho = $_SERVER['REMOTE_HOST'];
53+$htre = $_SERVER["HTTP_REFERER"];
54+$qust = $_SERVER['QUERY_STRING'];
55+$htus = $_SERVER['HTTP_USER_AGENT'];
56+
57+if(0 >= strlen($htco)){ $htco = "NOT"; }
58+if(0 >= strlen($htac)){ $htac = "NOT"; }
59+if(0 >= strlen($htcon)){ $htcon = "NOT"; }
60+if(0 >= strlen($htho)){ $htho = "NOT"; }
61+if(0 >= strlen($read)){ $read = "NOT"; }
62+if(0 >= strlen($reho)){ $reho = "NOT"; }
63+if(0 >= strlen($htre)){ $htre = "NOT"; }
64+if(0 >= strlen($qust)){ $qust = "NOT"; }
65+if(0 >= strlen($htus)){ $htus = "NOT"; }
66+
67+$wdate = date("U Y m d H i s");
68+
69+if(0 >= strlen($__dblogfile)){
70+ $logfile = "/tmp/apo.log";
71+ }
72+else{
73+ $logfile = $__dblogfile;
74+ }
75+
76+if(($fp = fopen($logfile, "a+"))==NULL){
77+ print("__dblogfile not open: sql = $sql\n");
78+ }
79+
80+$alldata = $udate . "\t" . $htco . "\t" . $htac . "\t" . $htcon . "\t" . $htho . "\t" . $read . "\t" . $reho . "\t" . $htre . "\t" . $qust . "\t" . $htus . "\t" . $sql . "\n";
81+ fwrite($fp, $alldata);
82+ fclose($fp);
83+ }
84+
85+if(0 == strcmp($__database, "POSTGRES")){
86+ $result = pg_query($conn, $sql);
87+ return $result;
88+ }
89+else if(0 == strcmp($__database, "MYSQL")){
90+ $result = mysql_query($sql, $conn);
91+ return $result;
92+ }
93+else{
94+ }
95+return $result;
96+}
97+
98+
99+
100+
101+function db_num_rows($result)
102+{
103+require("../config.inc");
104+
105+if(0 == strcmp($__database, "POSTGRES")){
106+ $num = pg_num_rows($result);
107+ return $num;
108+ }
109+else if(0 == strcmp($_database, "MYSQL")){
110+ $num = mysql_num_rows($result);
111+ return $num;
112+ }
113+
114+return 0;
115+}
116+
117+
118+
119+
120+function db_fetch_Result($result, $row, $field)
121+{
122+require("../config.inc");
123+
124+if(0 == strcmp($__database, "POSTGRES")){
125+ $reso = pg_fetch_Result($result, $row, $field);
126+ return $reso;
127+ }
128+else if(0 == strcmp($__database, "MYSQL")){
129+ if(mysql_data_seek($result, $row)){
130+ $item = mysql_fetch_object($result);
131+ $reso = $item->$field;
132+
133+ }
134+ else{
135+ echo "not seek data! \n";
136+ }
137+ return $reso;
138+ }
139+
140+}
141+
142+
143+function db_free_result($result)
144+{
145+require("../config.inc");
146+
147+if(0 == strcmp($__database, "POSTGRES")){
148+ pg_free_result($result);
149+ return 0;
150+ }
151+else if(0 == strcmp($__database, "MYSQL")){
152+ mysql_free_result($result);
153+ return 0;
154+ }
155+
156+}
157+
158+
159+
160+function db_Close($conn)
161+{
162+require("../config.inc");
163+
164+if(0 == strcmp($__database, "POSTGRES")){
165+ pg_Close($conn);
166+ return 0;
167+ }
168+else if(0 == strcmp($__database, "MYSQL")){
169+ mysql_close($conn);
170+ return 0;
171+ }
172+
173+}
174+
175+
176+
177+
178+?>
179+
180+
181+
182+
--- a/ds-apollon/index.php
+++ b/ds-apollon/index.php
@@ -1,12 +1,20 @@
11 <?php
2+// --- コンフィグレーション ---
3+include './include/php/config.inc';
4+
5+// --- time zone set ---
6+date_default_timezone_set($__timezone);
27
38 // --- グローバル変数設定 ---
4-date_default_timezone_set('Asia/Tokyo');
59 $_set = 0;
610 $_login_name ="";
711 $_pass_word ="";
812 $_session = 0;
913
14+// --- 関数のインクルード ---
15+include './include/php/auth_db.inc';
16+
17+
1018 // --- POST データの処理 ---
1119 if (!empty($_POST)){
1220 $SET = htmlspecialchars((int)$_POST["SET"]);
@@ -28,7 +36,8 @@ if( $_set == 0 ){
2836
2937 // --- _set1 認証確認 ---
3038 else if( $_set == 1 ){
31- if(0 == strcmp("masashi@ms-n.com", $_login_name) && 0 == strcmp("1234567890", $_pass_word)){ // はじめの認証設定
39+// if(0 == strcmp("masashi@ms-n.com", $_login_name) && 0 == strcmp("1234567890", $_pass_word)){ // はじめの認証設定
40+ if(0 == user_auth_db($_login_name, $_pass_word)){ // はじめの認証設定
3241 include './include/php/session_start.inc'; // セッション 開始処理
3342 $_set = 3;
3443 include './include/html/html_list.inc'; // ログイン完了画面に飛ぶ
旧リポジトリブラウザで表示