Blame | Last modification | View Log | RSS feed
<?php#指派命名空間namespace qbpwcf;#匯入外部套件include("../allInOne.php");#提示目前正在執行的部分echo"<hr>csInformation::getUserBrowserType - testCase 1<p>";/*#涵式說明:#取得用戶端的瀏覽器版本資訊,並回傳。#回傳結果:#$result,瀏覽器的資訊$result["userBrowserType"]=csInformation::getUserBrowserType();#檢查變數內容var_dump($result["userBrowserType"]);*/#提示目前正在執行的部分echo"<hr>csInformation::getClientIP - testCase 1<p>";/*#涵式說明:#回傳用戶端的IP位置#回傳的結果:#$result,用戶端的ip$result["getClientIP"]=csInformation::getClientIP();#檢查變數內容var_dump($result["getClientIP"]);*/#提示目前正在執行的部分echo"<hr>csInformation::getServerIP - testCase 1<p>";/*#涵式說明:#取得伺服器的IP,並回傳。#回傳的結果:#$result,伺服端的IP#備註:#伺服端必須被 localhost 以外的網址連結才會出現正確的IP$result["getServerIP"]=csInformation::getServerIP();#檢查變數內容var_dump($result["getServerIP"]);*/#提示目前正在執行的部分echo"<hr>csInformation::getPathOfThisPhpFile - testCase 1<p>";/*#涵式說明:#取得目前瀏覽的頁面的路徑#回傳的結果:#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.#$result["error"],錯誤訊息.#$result["function"],檔前執行的函數名稱.#$result["content"],目前瀏覽的頁面的路徑.#必填的參數:$conf["type"]="full";#想要取得的路徑類型,full代表完整路徑、lastLayer代表上一層目錄的名稱#參考資料:http:#blog.longwin.com.tw/2009/01/php-get-directory-file-path-dirname-2008/var_dump(csInformation::getPathOfThisPhpFile($conf));unset($conf);*/#提示目前正在執行的部分echo"<hr>csInformation::getPathOfThisPhpFile - testCase 2<p>";/*#涵式說明:#取得目前瀏覽的頁面的路徑#回傳的結果:#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.#$result["error"],錯誤訊息.#$result["function"],檔前執行的函數名稱.#$result["content"],目前瀏覽的頁面的路徑.#必填的參數:$conf["type"]="lastLayer";#想要取得的路徑類型,full代表完整路徑、lastLayer代表上一層目錄的名稱#參考資料:http:#blog.longwin.com.tw/2009/01/php-get-directory-file-path-dirname-2008/var_dump(csInformation::getPathOfThisPhpFile($conf));unset($conf);*/#提示目前正在執行的部分echo"<hr>csInformation::getPathOfThisPhpFile - testCase 3<p>";/*#涵式說明:#取得目前瀏覽的頁面的路徑#回傳的結果:#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.#$result["error"],錯誤訊息.#$result["function"],檔前執行的函數名稱.#$result["content"],目前瀏覽的頁面的路徑.#必填的參數:$conf["type"]="pathOnly";#想要取得的路徑類型,full代表完整路徑、lastLayer代表上一層目錄的名稱#參考資料:http:#blog.longwin.com.tw/2009/01/php-get-directory-file-path-dirname-2008/var_dump(csInformation::getPathOfThisPhpFile($conf));unset($conf);*/#提示目前正在執行的部分echo"<hr>csInformation::getConnectionInfo - testCase 1<p>";/*#涵式說明:#取得用戶端的資訊#回傳的結果:#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.#$result["error"],錯誤訊息.#$result["function"],檔前執行的函數名稱.#$result["userBrowserType"],爲使用者的瀏覽器資訊#$result["userIp"],爲使用者的IP#$result["requestUri"],爲使用者要求的網址#$result["username"],爲使用者目前的帳戶,若爲""則表示尚未登入成功#必填的參數:$conf["getAccount"]="true";#是否要取得帳號#可省略的參數:#$conf["accountVar"]=$_SESSION["username"];#帳號儲存在哪個變數裏面,預設爲$_SESSION["username"]$conf["saveToDb"]="true";#是否要除儲存到資料庫,"true"為要儲存",預設為不儲存$conf["dbAddress"]=$dbAddress;;#爲mysql-Server的位置,若#$conf["saveToDb"]設為"true",則該參數為必填。$conf["dbAccount"]=$dbAccount;#爲用於連入mysql-Server時要使用的帳號,若#$conf["saveToDb"]設為"true",則該參數為必填。$conf["dbName"]=$dbName;#要選取的資料庫名稱,若#$conf["saveToDb"]設為"true",則該參數為必填。$conf["tableName"]="visitorInfo";#爲要插入資料的資料表名稱,若#$conf["saveToDb"]設為"true",則該參數為必填。$conf["columnName"]=array("username","userWebBrowser","userIp","requestUri","systemDateAndTime");#爲資料表的項目名稱,#例如:$conf["columnName"]=array("columnName1","columnName2","columnName3",...);#寫入的資料依序為,使用者帳戶、瀏覽器資訊、使用者IP、觀看的網址、當時的時間#$conf["saveToDb"]設為"true",則該參數為必填。$conf["dbPassword"]=$dbPassword;#爲連線到mysql-Server時要使用的密碼,可省略,若省略則代表不使用密碼$conf["displayQueryError"]="true";#爲是否呈現Query的錯誤訊息,預設不呈現,若要呈現則請將此值設爲"true"$conf["displayQueryString"]="true";#爲是否呈現Query的命令,預設不呈現,若要呈現則請將此值設爲"true"var_dump(csInformation::getConnectionInfo($conf));unset($conf);*//*#提示目前正在執行的部分echo"<hr>csInformation::getServerRealIP - testCase 1<p>";##涵式說明:#依據提供查詢IP服務的網站取得伺服器對外的IP.#回傳的結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["function"],當前執行的函數名稱.#$result["error"],錯誤訊息陣列.#$result["content"],伺服端對外的IP.#必填參數:#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;var_dump(csInformation::getServerRealIP($conf));unset($conf);*/#提示目前正在執行的部分echo"<hr>csInformation::getClientPort - testCase 1<p>";/*#涵式說明:#回傳用戶端連線到網頁的port#回傳的結果:#$result,用戶端連線到網頁的portvar_dump(csInformation::getClientPort());*/#提示目前正在執行的部分echo"<hr>csInformation::getEnv - testCase 1<p>";/*#涵式說明:#判斷當前環境為web還是cmd#回傳結果:#$result,"web"或"cmd"var_dump(csInformation::getEnv());*/#提示目前正在執行的部分echo"<hr>csInformation::getServerIPs - testCase 1<p>";/*#涵式說明:#取得主機可能的ip位址#回傳的結果:#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.#$result["error"],錯誤訊息.#$result["function"],檔前執行的函數名稱.#$result["content"],目前瀏覽的頁面的路徑.#必填參數:#$conf["fileArgu"],字串,__FILE__的內容.$conf["fileArgu"]=__FILE__;#可省略參數:#無#備註:#僅能在命令列執行.#建構中...$getServerIPs=csInformation::getServerIPs($conf);#如果取得伺服器可能的ip失敗if($getServerIPs["status"]==="false"){#印出結果var_dump($getServerIPs);#結束程式exit;}#if end#印出結果var_dump($getServerIPs["content"]);*/#提示目前正在執行的部分echo"<hr>csInformation::getIpGeo - testCase 1<p>";/*#涵式說明:#取得 dns/ip 的地理位置資訊#必填參數:#$conf["fileArgu"],字串,__FILE__的內容.$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["addr"],字串,dns或ip.$conf["addr"]="qbpwcf.bridge.cloudns.asia";$getIpGeo=csInformation::getIpGeo($conf);unset($conf);var_dump($getIpGeo);*//*#提示目前正在執行的部分echo"<hr>csInformation::ipv4toipv6 - testCase 1<p>";#函式說明:#將ipv4轉換成ipv6#回傳結果:##必填參數:#$conf["ipv4"],字串,人可讀的ipv4字串.$conf["ipv4"]="3.1.205.119";#可省略參數:#無.#參考資料:#http://benjr.tw/17314$ipv4toipv6=csInformation::ipv4toipv6($conf);unset($conf);#如果取得伺服器可能的ip失敗if($ipv4toipv6["status"]==="false"){#印出結果var_dump($ipv4toipv6);#結束程式exit;}#if end#印出結果var_dump($ipv4toipv6);*/?>