Rev 317 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*QBPWCF, Quick Build PHP website Component base on Fedora Linux.Copyright (C) 2014~2026 MIN ZHI, CHENThis file is part of QBPWCF.QBPWCF is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with QBPWCF. If not, see <http://www.gnu.org/licenses/>.*//*本程式說明:已拋棄.*/#使用命名空間qbpwcfnamespace qbpwcf;#初始化輸出$output=array();#取得 lib pathexec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../../../../usr/bin/libexec/folderOfUsrLib.php"),$output,$status);#如果執行失敗if($status!==0){#debugvar_dump(__LINE__,$output);#結束執行,回傳shell 1.exit(1);}#if end#儲存lib path$folderOfUsrLib=$output[0];#初始化輸出$output=array();#以該檔案的實際位置的 lib path 為 include path 首位exec("cd ".pathinfo(__FILE__)["dirname"]."/../../../../../usr/".$folderOfUsrLib."/qbpwcf;pwd;",$output,$status);set_include_path($output[0].PATH_SEPARATOR.get_include_path());#建議的log位置$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";#關閉既有sessionsession_abort();#設置session儲存位置session_save_path(".hta-session");#啟動 sessionsession_start();#取得session id$sId=session_id();#匯入套件require_once("allInOne.php");#函式說明:#建立以圖片(PNG格式)呈現的驗證碼.#回傳的解果:#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.#$result["error"],錯誤訊息.#$result["function"],檔前執行的函數名稱.#$result["randNumberWord"],傳驗證碼的內容.#$result["imgAddress"],包含src圖片的位置與名稱.#$result["imgSrcVal"],放在src裏面的圖片位置與名稱.#必填參數:#$conf["imgAddressAndName"],字串,爲驗證碼圖片儲存的位置與名稱,副檔名程式會自動產生$conf["imgAddressAndName"]="/tmp/notExsit.img";#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["num"],字串,爲驗證碼的位數,請輸入阿拉伯數字,預設為"8"位數.#$conf["num"]="8";#$conf["disableImg"],字串,是否要取消驗證碼圖片的輸出,"true"為要取消,預設為"false"為不取消$conf["disableImg"]="true";#$conf["imgToData"],字串,預設為"true"代表將圖片轉存成base64圖片,並將原始圖片移除;反之為"false"#$conf["imgToData"]="true";#$conf["class"],字串,圖片要套用的css樣式類別.#$conf["class"]="";#$conf["content"],字串陣列,允許的亂數陣列內容,預設爲(1~9 and A~Z).#$conf["content"]=array();#參考資料:#無.#備註:#無.$validationCode=authenticate::validationCode($conf);unset($conf);#如果執行失敗if($validationCode["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$validationCode;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出json結果echo json_encode($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#隨機產生字串$randomStr=$validationCode["randNumberWord"];#session file 的儲存路徑$sessionStorePath=shell_exec("pwd")."/.hta-session/";#變成json字串#指定要使用的函式(callFunc)#指定session檔案的位置(sessionStorePath)#指定session檔案名稱的關鍵內容(sId)#設置最長等待(timeout)300秒#透過randomStr讓內容隨着時間變化$jsonStr=json_encode(array("callFunc"=>"checkStatusOfEmailVarify","timeout"=>"300","randomStr"=>$randomStr,"sessionStorePath"=>$sessionStorePath,"sId"=>$sId));#用GnuPG加密#函式說明:#加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["function"],當前執行的函數名稱.#$result["content"],加密後的結果.#$result["error"],錯誤訊息陣列.#$result["argu"],使用的參數.#必填參數:#$conf["enCodeStr"],any,要加密的字串,陣列,物件.$conf["enCodeStr"]=$jsonStr;#$conf["enCodeType"],"字串",加密的類型,有"sha1"與"md5"與"p_hash"與"aes256"與"qbpwcf"與"bin2hex"與"hex2bin"與"gpg",8種,"sha1"較耗時,"md5"較快,"p_hash"適用於密碼加密,"aes256"是對稱式加解密,"qbpwcf"是透過urlencode、json_encode、base64_encode的結果,"bin2hex"是依照每個byte的整數數值轉成"00"~"FF"後的結果,反之為"hex2bin","gpg"是應用gpg進行加解密,需要先有ID對應的key.$conf["enCodeType"]="gpg";#可省略參數:#$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".#$conf["sha1Raw"]="false";#$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.#$conf["p_hash"]="";#$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.#$conf["keyForAes256"]="";#$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.#$conf["aes256Encode"]="";#$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.#$conf["qbpwcfDecode"]="false";#$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.#$conf["gpgDecrypt"]="false";#$conf["gpgId"],字串,若"enCodeType"為"gpg"時,該參數必填.$conf["gpgId"]=gnupgId;#參考資料:#sha1=>http://php.net/manual/en/function.sha1.php#md5=>http://php.net/manual/en/function.md5.php#password_hash=>http://php.net/manual/en/function.password-hash.php#password_verify=>http://php.net/manual/en/function.password-verify.php#json_decode=>https://www.php.net/manual/en/function.json-decode.php#備註:#無.$enCodeStr=authenticate::enCodeStr($conf);unset($conf);#如果執行失敗if($enCodeStr["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$enCodeStr;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出json結果echo json_encode($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#取得加密後的json字串$encryptedJsonStr=$enCodeStr["content"];#函式說明:#加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["function"],當前執行的函數名稱.#$result["content"],加密後的結果.#$result["error"],錯誤訊息陣列.#$result["argu"],使用的參數.#必填參數:#$conf["enCodeStr"],any,要加密的字串,陣列,物件.$conf["enCodeStr"]=$encryptedJsonStr;#$conf["enCodeType"],"字串",加密的類型,有"sha1"與"md5"與"p_hash"與"aes256"與"qbpwcf"與"bin2hex"與"hex2bin",7種,"sha1"較耗時,"md5"較快,"p_hash"適用於密碼加密,"aes256"是對稱式加解密,"qbpwcf"是透過urlencode、json_encode、base64_encode的結果,"bin2hex"是依照每個byte的整數數值轉成"00"~"FF"後的結果,反之為"hex2bin".$conf["enCodeType"]="bin2hex";#可省略參數:#$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".#$conf["sha1Raw"]="false";#$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.#$conf["p_hash"]="";#$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.#$conf["keyForAes256"]="";#$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.#$conf["aes256Encode"]="";#$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.#$conf["qbpwcfDecode"]="false";#參考資料:#sha1=>http://php.net/manual/en/function.sha1.php#md5=>http://php.net/manual/en/function.md5.php#password_hash=>http://php.net/manual/en/function.password-hash.php#password_verify=>http://php.net/manual/en/function.password-verify.php#json_decode=>https://www.php.net/manual/en/function.json-decode.php#備註:#無.$enCodeStr=authenticate::enCodeStr($conf);unset($conf);#如果執行失敗if($enCodeStr["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$enCodeStr;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出json結果echo json_encode($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#取得編碼後的加密後的json字串$encodedEencryptedJsonStr=$enCodeStr["content"];#函式說明:#可以輸入Email的輸入方框#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["function"],當前執行的函數.#$result["error"],錯誤訊息陣列.#$result["content"],按鈕語法.#必填參數:#$conf["name"],字串,爲該文字輸入框的名稱,用於讓接收頁面讀取的名稱。$conf["name"]="email";#$conf["readOnly"],字串,爲該文字框是否可以填寫資料,若要只能觀看不能填寫,那麼就必須將其值設爲"true",反之要設爲"false".$conf["readOnly"]="false";#可省略參數:#$conf["width"],字串,爲文字框的外觀長度,預設為"100%".#$conf["width"]="";#$conf["maxInputLength"],字串,爲可輸入的最大位元長度,預設不限制.#$conf["maxInputLength"]="";#$conf["autoFocus"],字串,是否為將填寫的指標移到該表單,"true"代表要,預設為"false".$conf["autoFocus"]="true";#$conf["value"],字串,爲該文字框預設要顯示的文字,預設爲"".#$conf["value"]="";#$conf["class"],字串,爲要套用的css樣式,若省略,則會套用預設的 "__qbpwcf_inputTextCssStyle" 樣式,其屬性爲 "width:100%","font-size:30px"#$conf["class"]="";#$conf["classList"],字串陣列,為要使用的多個css class樣式,若有使用,則會取代"class"參數的設定.#$conf["classList"]=array();#$conf["jsActivitor"],字串,爲觸發js的條件,可以是"onChange"(已改變內容時)、"onClick"(按下按鈕時)、"onkeyup"(當鍵盤按下放開後)、"onmouseover"(當滑鼠移過去的時候)...,須搭配$conf["jsSubmitActionTarget"]參數。#$conf["jsActivitor"]="";#$conf["jsAction"],字串,爲該js是要做什麼,可以是"document.testForm.submit()"(傳送名爲testForm的表單內容)...,須搭配$conf["jsActivitor"]參數。#$conf["jsAction"]="";#$conf["trStart"],字串,爲是否要以<tr>開頭,"true"表示"是"。也可以看作新的一列開始,預設為"false".#$conf["trStart"]="";#$conf["tdStart"],字串,爲是否要以<td>開頭,"true"表示"是"。也可以看成列裏面的元素開始,預設為"false".#$conf["tdStart"]="";#$conf["formStart"],字串,爲是否要以<form>開頭,"true"表示"是",也可以看成表單的開始,預設為"false".#$conf["formStart"]="";#$conf["formAction"],字串,表單遞交的目的地,若$conf["formStart"]為"true",則該參數不能省略.#$conf["formAction"]="";#$conf["formName"],字串,爲該表單的名稱#$conf["formName"]="email";#$conf["formMethod"],字串,爲傳輸的方法,若沒設定則預設爲post,其他可用的參數爲get。#$conf["formMethod"]="";#$conf["formTarget"],字串,為顯示的方式,若沒設定則預設爲"_self",其他可用的參數爲 "_blank"、"_parent"、"_top",也可以是iframe的名稱。#$conf["formTarget"]="";#$conf["tableStart"],字串,爲該表單是否要以<table>開始。"true"爲是,預設為"false".#$conf["tableStart"]="";#$conf["tableClass"],字串,表格要套用的css樣式,若爲"__withoutBorder"的話則套用無框線的預設樣式;若爲"__withBorder"的話,則爲有框線的預設樣式,預設為"__withoutBorder".#$conf["tableClass"]="";#$conf["formEnd"],字串,爲是否要以<form>結尾,"true"表示"是",也可以看成表單的結束,預設為"false".#$conf["formEnd"]="true";#$conf["tdEnd"],字串,爲是否要以</td>結尾,"true"表示"是"。也可以看成列裏面的元素結束,預設為"false".#$conf["tdEnd"]="true";#$conf["trEnd"],字串,爲是否要以</tr>結尾,"true"表示"是"。也可以看作該列結束,預設為"false".#$conf["trEnd"]="true";#$conf["tableEnd"],字串,爲該表單是否要以</table>結尾,"true"爲是,預設為"false".#$conf["tableEnd"]="true";#$conf["autocomplete"],字串,是否依據使用者過往輸入的記錄來提示可能要的輸入內容,"on"為啟用,"off"為停用,預設為"on".#$conf["autocomplete"]="off";#$conf["required"],字串,該欄位是否必填,"true"為必填,"false"為可留空,預設為"false".$conf["required"]="true";#$conf["comment"],字串,輸入方框上面要放哪些註解文字,亦即用label來呈現,同時指定"for"屬性的數值為當前"input"標籤的id,意即參數"name"的內容.$conf["comment"]="請先進行Email認證";#$conf["placeholder"],字串,當沒有內容時要顯示的內容.$conf["placeholder"]="username@mail.doamin";#$conf["br"],字串,"true"代表最後要換行,預設為"false".#$conf["br"]="true";#$conf["p"],字串,"true"代表最後要空一行,預設為"false".#$conf["p"]="true";#$conf["id"],字串,該元素的id,預設不使用.$conf["id"]="email";#$conf["dataFormId"],字串,提供用於識別哪一張表單的data屬性名稱.#$conf["dataFormId"]="";#參考資料:#https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/email#備註:#無.$inputEmail=form::inputEmail($conf);unset($conf);#如果執行失敗if($inputEmail["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$inputEmail;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出結果var_dump($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#印出語法echo $inputEmail["content"];#函式說明:#放置按鈕#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["function"],當前執行的函數.#$result["error"],錯誤訊息陣列.#$result["content"],按鈕語法.#必填參數:$conf["buttonDisplayValue"]="驗證Email";#爲按鈕上顯示的文字。#可省略參數:#$conf["buttonStyleName"]="";#可省略,爲按鈕所要使用的css樣式類別名稱,預設的css樣式爲 __qbpwcf_button 。#$conf["buttonActionScriptFunction"]="";#可省略,爲按下按鈕時所要執行的javaScript函式或程式,預設不設定。#"document.forms.formName.submit()"爲傳送名爲testForm的表單內容#"window.print()"爲使用瀏覽器內建工具列印當前網頁#若搭配 javaScript 類別的 confirmWindow 函數的回傳結果,則會有確認視窗的效果.#$conf["buttonBorder"]="";#可省略,爲IE9內會自動產生外框,此爲外框的厚度,屬性值爲正整數,預設爲0。#$conf["disabled"]="true";#可省略,為按鈕的功能是否要取消,若為"true"則代表要取消,若為"false"則代表功能正常,預設為"false".#$conf["tableStart"]="true";#爲是否要表格開始。"false"代表否,"true"代表是。預設爲"false"。#$conf["tableClass"]="";#表格要套用的css樣式,若省略的話,則預設爲 __defaultTbaleCsssStyle 其屬性爲 table-layout:fixed word-break:break-all width:100% ,須搭配 $conf["tablStart"] 與 $conf["tableEnd"] 使用。#$conf["trStart"]="true";#爲是否要以<tr>開頭,"true"表示"是"。也可以看作新的一列開始,預設為"false".#$conf["trClass"]="__withoutBorder";#<tr>要套用的css樣式,預設為"__withoutBorder",亦即沒有框線的樣式;"__withBorder"則爲有框線的樣式#$conf["tdStart"]="true";#爲是否要以<td>開頭,"true"表示"是"。也可以看成列裏面的元素開始,預設為"false".#$conf["tdClass"]="__withoutBorder";#<td>要套用的css樣式,"__withoutBorder"爲沒有框線的樣式;__withBorder爲有框線的樣式#$conf["tdEnd"]="true";#爲是否要以</td>結尾,"true"表示"是"。也可以看成列裏面的元素結束,預設為"false".#$conf["trEnd"]="true";#爲是否要以</tr>結尾,"true"表示"是"。也可以看作該列結束,預設為"false".#$conf["tableEnd"]="true";#爲是否要表格結束。"false"代表否,"true"代表是,預設爲"false"。#$conf["formStart"]="true";#爲是否要表單開始,如果爲"true"則代表要表單開始,預設為"false".#$conf["action"]="";#爲表單要傳送到哪個頁面,須搭配$conf["formStart"]與$conf["formEnd"]參數使用#$conf["target"]="";#為目標表單顯示的方式,若沒設定則預設爲"_self",其他可用的參數爲 "_blank"、"_parent"、"_top",也可以是iframe的名稱。須搭配$conf["formStart"]與$conf["formEnd"]參數使用#$conf["formEnd"]="true";#爲是否要表單結束,如果爲"true"則代表要表單結束,預設為"false".#$conf["formId"],字串,表單的id.#$conf["formId"]="";#$conf["buttonId"],字串,按鈕的id.$conf["buttonId"]="validEmailBtn";#參考資料:#http://stackoverflow.com/questions/3014649/how-to-disable-html-button-using-javascript#備註:#無.$button=form::button($conf);unset($conf);#如果執行失敗if($button["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$button;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出結果var_dump($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#印出按鈕echo $button["content"];#函式說明:#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).#回傳結果:#$result["status"],執行是否正常,"true"為正常,"false"為不正常.#$result["error"],錯誤訊息陣列#$result["function"],當前執行的函數名稱#$result["content"],要執行的javaScript語法#必填參數:#$conf["script"],字串,要執行的javaScript語法.$conf["script"]="//匿名的函式var waitVerifiedEmail=function(){//建立跟 server 的 web socket,並等待訊息//連線到web socket,並傳輸資料,會回傳promise.亦即要在 async function 中使用,且使用 await 來取得結果.//params,參數物件.//params.url,web socket的url,加密的連線為 wss://url,url預設為當前頁面的 domain name.//params.callback,函式,參數為收到的訊息,收到訊息後要怎麼處理.//params.data,要傳輸的資料物件.//params.data.id,用於識別wss連線是屬於誰的id資訊,預設為自動產生.param={};param.url='wss://ws.qbpwcf.org';param.data={};param.data.secrect='".$encodedEencryptedJsonStr."';var res=await window.qbpwcf.ws.init(param);//debugconsole.log(res);//如果收到驗證通過的訊息if(res==='pass'){//設置給予parent的用戶emailwindow.parent.window.validEmail=email.value;//將本iframe移除window.parent.window.document.getElementsByTagName('iframe')[0].remove();}//if end}//function end//取得驗證email的按鈕var validEmailBtn=document.getElementById('validEmailBtn');//取得要驗證emailvar email=document.getElementById('email');//點擊驗證email按鈕後validEmailBtn.addEventListener('click',async function(e){//若 email 無效if(email.validity.valid===false){//關注 email 欄位email.focus();}//if end//反之else{/*設置 window.qbpwcf.ajaxP 函數說明:傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.參數:params={};params.method='POST' or 'GET' or 'HEAD' or 'OPTIONS';params.headers={name:value};params.url='url to request';params.preAc='function name to call before send request';params.data='data to contain','key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';if no data please use {};參考資料:https://eyesofkids.gitbooks.io/javascript-start-es6-promise/content/contents/ch11_snippets.htmlhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise*/params={};params.method='POST';params.url='../sendMailAgent/';//params.preAc='function name to call before send request';params.data='email='+encodeURIComponent(email.value);var res=await window.qbpwcf.ajaxP(params);//等待認證通過waitVerifiedEmail;}//else end});";#可省略參數:#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.#$conf["onReady"]="true";#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.#$conf["globalJs"]=array();#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.#$conf["jsFunciton"]=array();#$conf["noScriptTag"],字串,是否不要輸出<script></script>,預設為"false",代表要輸出;反之為"true",代表不要輸出.#$conf["noScriptTag"]="false";#參考資料:#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the#備註:#無.$toScript=javaScript::toScript($conf);unset($conf);#如果執行失敗if($toScript["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$toScript;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出結果var_dump($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#印出語法echo $toScript["content"];