Subversion Repositories php-qbpwcf

Rev

Rev 226 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 liveuser 1
<?php
2
 
3
/*
4
 
5
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
239 liveuser 6
    Copyright (C) 2014~2026 MIN ZHI, CHEN
1 liveuser 7
 
8
    This file is part of QBPWCF.
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
 
15
    QBPWCF is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
 
23
*/
24
 
25
#使用命名空間qbpwcf
26
namespace qbpwcf;
27
 
28
#初始化輸出
29
$output=array();
30
 
31
#取得 lib path
99 liveuser 32
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../../../usr/bin/libexec/folderOfUsrLib.php"),$output,$status);
1 liveuser 33
 
34
#如果執行失敗
35
if($status!==0){
36
 
37
	#debug
38
	var_dump(__LINE__,$output);
39
 
40
	#結束執行,回傳shell 1.
41
	exit(1);
42
 
43
	}#if end
44
 
45
#儲存lib path
46
$folderOfUsrLib=$output[0];
47
 
48
#初始化輸出
49
$output=array();
50
 
51
#以該檔案的實際位置的 lib path 為 include path 首位
99 liveuser 52
exec("cd ".pathinfo(__FILE__)["dirname"]."/../../../../usr/".$folderOfUsrLib."/qbpwcf;pwd;",$output,$status);
1 liveuser 53
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
54
 
55
#匯入套件
56
require_once("allInOne.php");
57
 
58
#函式說明:
59
#取得用戶端的資訊,並依據需要寫入到資料表裡面
60
#回傳的結果:
61
#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
62
#$result["error"],錯誤訊息.
63
#$result["function"],檔前執行的函數名稱.
64
#$result["mode"],當前的模式是"cmd"還是"web".
65
#$result["userBrowserType"],爲使用者的瀏覽器資訊
66
#$result["userIp"],爲使用者的IP
67
#$result["serverIp"],為伺服器的IP
68
#$result["server_name"],伺服器的 domain name
69
#$result["scheme"],通訊協定
70
#$result["serverPort"],伺服器給對外下載網頁的port
71
#$result["requestUri"],爲使用者要求的網址/php檔案.
72
#$result["requestUriFull"],為使用者要求的完整網址/php檔案路徑.
73
#$result["clientRequestIP"],用戶端要求的ip與port
74
#$result["username"],爲使用者目前的帳戶,若爲""則表示尚未登入成功
75
#$result["phpUser"],運行該php的使用者帳戶.若為空字串則代表非使用者直接觸發.
76
#$result["phpUserType"],運行該php的使用者帳戶類型,可能有"regular(no wheel member)","wheel(can use sudo)","intrinsic(root)","system(qemu,apache,...)".
77
#$result["header"],接收到的 header 陣列.
78
#$result["body"],接收到的 body 字串.
79
#必填參數:
80
#$conf["getAccount"],字串,是否要取得帳號,"true"代表要;"false"代表不要.
81
$conf["getAccount"]="true";
82
#可省略參數:
83
#$conf["accountVar"],字串,帳號儲存在哪個變數裏面,預設爲$_SESSION["username"].
84
#$conf["accountVar"]=$_SESSION["username"];
85
#$conf["saveToDb"],字串,是否要除儲存到資料庫,"true"為要儲存",預設為"false"不儲存.
86
#$conf["saveToDb"]="true";
87
#$conf["dbAddress"],字串,爲mysql/mariadb server的位置,若saveToDb設為"true",則該參數為必填.
88
#$conf["dbAddress"]=$dbAddress;
89
#$conf["dbAccount"],字串,爲用於連入mysql/mariadb server時要使用的帳號,若saveToDb設為"true",則該參數為必填.
90
#$conf["dbAccount"]=$dbAccount;
91
#$conf["dbName"],字串,要選取的資料庫名稱,若saveToDb設為"true",則該參數為必填.
92
#$conf["dbName"]=$dbName;
93
#$conf["tableName"],字串,爲要插入資料的資料表名稱,若saveToDb設為"true",則該參數為必填.
94
#$conf["tableName"]="visitorInfo";
95
#$conf["columnName"],字串陣列,爲資料表的項目名稱,例如:$conf["columnName"]=array("columnName1","columnName2","columnName3",...);寫入的資料依序為,使用者帳戶、瀏覽器資訊、使用者IP、觀看的網址、當時的時間.若saveToDb設為"true",則該參數為必填.
96
#$conf["columnName"]=array("username","userWebBrowser","userIp","requestUri","systemDateAndTime");
97
#$conf["dbPassword"],字串,爲連線到mysql/mariadb server時要使用的密碼,可省略,若省略則代表不使用密碼.
98
#$conf["dbPassword"]=$dbPassword;
99
#參考資料:
100
#$_SERVER=>http://php.net/manual/zh/reserved.variables.server.php
101
#取得伺服器名稱與IP=>http://php.net/manual/en/function.gethostname.php
102
#備註:
103
#無.
104
$getConnectionInfo=csInformation::getConnectionInfo($conf);
105
unset($conf);
106
 
107
#顯示結果
226 liveuser 108
var_dump($getConnectionInfo);