Subversion Repositories qbpwcf-lib(archive)

Rev

Blame | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2015~2024 Min-Jhin,Chen

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/

#使用命名空間qbpwcf
namespace qbpwcf;

#匯入外部套件
require_once("qbpwcf/allInOne.php");

#函式說明:
#取得用戶端的資訊,並依據需要寫入到資料表裡面
#回傳的結果:
#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
#$result["error"],錯誤訊息.
#$result["function"],檔前執行的函數名稱.
#$result["mode"],當前的模式是"cmd"還是"web".
#$result["userBrowserType"],爲使用者的瀏覽器資訊
#$result["userIp"],爲使用者的IP
#$result["serverIp"],為伺服器的IP
#$result["server_name"],伺服器的 domain name
#$result["scheme"],通訊協定
#$result["serverPort"],伺服器給對外下載網頁的port
#$result["requestUri"],爲使用者要求的網址/php檔案.
#$result["requestUriFull"],為使用者要求的完整網址/php檔案路徑.
#$result["clientRequestIP"],用戶端要求的ip與port
#$result["username"],爲使用者目前的帳戶,若爲""則表示尚未登入成功
#$result["phpUser"],運行該php的使用者帳戶.若為空字串則代表非使用者直接觸發.
#$result["phpUserType"],運行該php的使用者帳戶類型,可能有"regular(no wheel member)","wheel(can use sudo)","intrinsic(root)","system(qemu,apache,...)".
#$result["header"],接收到的 header 陣列.
#$result["body"],接收到的 body 字串.
#必填參數:
#$conf["getAccount"],字串,是否要取得帳號,"true"代表要;"false"代表不要.
$conf["getAccount"]="true";
#可省略參數:
#$conf["accountVar"],字串,帳號儲存在哪個變數裏面,預設爲$_SESSION["username"].
#$conf["accountVar"]=$_SESSION["username"];
#$conf["saveToDb"],字串,是否要除儲存到資料庫,"true"為要儲存",預設為"false"不儲存.
#$conf["saveToDb"]="true";
#$conf["dbAddress"],字串,爲mysql/mariadb server的位置,若saveToDb設為"true",則該參數為必填.
#$conf["dbAddress"]=$dbAddress;
#$conf["dbAccount"],字串,爲用於連入mysql/mariadb server時要使用的帳號,若saveToDb設為"true",則該參數為必填.
#$conf["dbAccount"]=$dbAccount;
#$conf["dbName"],字串,要選取的資料庫名稱,若saveToDb設為"true",則該參數為必填.
#$conf["dbName"]=$dbName;
#$conf["tableName"],字串,爲要插入資料的資料表名稱,若saveToDb設為"true",則該參數為必填.
#$conf["tableName"]="visitorInfo";
#$conf["columnName"],字串陣列,爲資料表的項目名稱,例如:$conf["columnName"]=array("columnName1","columnName2","columnName3",...);寫入的資料依序為,使用者帳戶、瀏覽器資訊、使用者IP、觀看的網址、當時的時間.若saveToDb設為"true",則該參數為必填.
#$conf["columnName"]=array("username","userWebBrowser","userIp","requestUri","systemDateAndTime");
#$conf["dbPassword"],字串,爲連線到mysql/mariadb server時要使用的密碼,可省略,若省略則代表不使用密碼.
#$conf["dbPassword"]=$dbPassword;
#參考資料:
#$_SERVER=>http://php.net/manual/zh/reserved.variables.server.php
#取得伺服器名稱與IP=>http://php.net/manual/en/function.gethostname.php
#備註:
#無.
$getConnectionInfo=csInformation::getConnectionInfo($conf);
unset($conf);

#顯示結果
var_dump($getConnectionInfo);