| 728 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
6 |
Copyright (C) 2015~2024 Min-Jhin,Chen
|
|
|
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 |
require_once("qbpwcf/allInOne.php");
|
|
|
30 |
|
|
|
31 |
#函式說明:
|
|
|
32 |
#取得用戶端的資訊,並依據需要寫入到資料表裡面
|
|
|
33 |
#回傳的結果:
|
|
|
34 |
#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
|
|
|
35 |
#$result["error"],錯誤訊息.
|
|
|
36 |
#$result["function"],檔前執行的函數名稱.
|
|
|
37 |
#$result["mode"],當前的模式是"cmd"還是"web".
|
|
|
38 |
#$result["userBrowserType"],爲使用者的瀏覽器資訊
|
|
|
39 |
#$result["userIp"],爲使用者的IP
|
|
|
40 |
#$result["serverIp"],為伺服器的IP
|
|
|
41 |
#$result["server_name"],伺服器的 domain name
|
|
|
42 |
#$result["scheme"],通訊協定
|
|
|
43 |
#$result["serverPort"],伺服器給對外下載網頁的port
|
|
|
44 |
#$result["requestUri"],爲使用者要求的網址/php檔案.
|
|
|
45 |
#$result["requestUriFull"],為使用者要求的完整網址/php檔案路徑.
|
|
|
46 |
#$result["clientRequestIP"],用戶端要求的ip與port
|
|
|
47 |
#$result["username"],爲使用者目前的帳戶,若爲""則表示尚未登入成功
|
|
|
48 |
#$result["phpUser"],運行該php的使用者帳戶.若為空字串則代表非使用者直接觸發.
|
|
|
49 |
#$result["phpUserType"],運行該php的使用者帳戶類型,可能有"regular(no wheel member)","wheel(can use sudo)","intrinsic(root)","system(qemu,apache,...)".
|
|
|
50 |
#$result["header"],接收到的 header 陣列.
|
|
|
51 |
#$result["body"],接收到的 body 字串.
|
|
|
52 |
#必填參數:
|
|
|
53 |
#$conf["getAccount"],字串,是否要取得帳號,"true"代表要;"false"代表不要.
|
|
|
54 |
$conf["getAccount"]="true";
|
|
|
55 |
#可省略參數:
|
|
|
56 |
#$conf["accountVar"],字串,帳號儲存在哪個變數裏面,預設爲$_SESSION["username"].
|
|
|
57 |
#$conf["accountVar"]=$_SESSION["username"];
|
|
|
58 |
#$conf["saveToDb"],字串,是否要除儲存到資料庫,"true"為要儲存",預設為"false"不儲存.
|
|
|
59 |
#$conf["saveToDb"]="true";
|
|
|
60 |
#$conf["dbAddress"],字串,爲mysql/mariadb server的位置,若saveToDb設為"true",則該參數為必填.
|
|
|
61 |
#$conf["dbAddress"]=$dbAddress;
|
|
|
62 |
#$conf["dbAccount"],字串,爲用於連入mysql/mariadb server時要使用的帳號,若saveToDb設為"true",則該參數為必填.
|
|
|
63 |
#$conf["dbAccount"]=$dbAccount;
|
|
|
64 |
#$conf["dbName"],字串,要選取的資料庫名稱,若saveToDb設為"true",則該參數為必填.
|
|
|
65 |
#$conf["dbName"]=$dbName;
|
|
|
66 |
#$conf["tableName"],字串,爲要插入資料的資料表名稱,若saveToDb設為"true",則該參數為必填.
|
|
|
67 |
#$conf["tableName"]="visitorInfo";
|
|
|
68 |
#$conf["columnName"],字串陣列,爲資料表的項目名稱,例如:$conf["columnName"]=array("columnName1","columnName2","columnName3",...);寫入的資料依序為,使用者帳戶、瀏覽器資訊、使用者IP、觀看的網址、當時的時間.若saveToDb設為"true",則該參數為必填.
|
|
|
69 |
#$conf["columnName"]=array("username","userWebBrowser","userIp","requestUri","systemDateAndTime");
|
|
|
70 |
#$conf["dbPassword"],字串,爲連線到mysql/mariadb server時要使用的密碼,可省略,若省略則代表不使用密碼.
|
|
|
71 |
#$conf["dbPassword"]=$dbPassword;
|
|
|
72 |
#參考資料:
|
|
|
73 |
#$_SERVER=>http://php.net/manual/zh/reserved.variables.server.php
|
|
|
74 |
#取得伺服器名稱與IP=>http://php.net/manual/en/function.gethostname.php
|
|
|
75 |
#備註:
|
|
|
76 |
#無.
|
|
|
77 |
$getConnectionInfo=csInformation::getConnectionInfo($conf);
|
|
|
78 |
unset($conf);
|
|
|
79 |
|
|
|
80 |
#顯示結果
|
|
|
81 |
var_dump($getConnectionInfo);
|