Subversion Repositories php-qbpwcf

Rev

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

Rev Author Line No. Line
317 liveuser 1
<?php
2
 
3
/*
4
 
5
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2014~2026 MIN ZHI, 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
/*
26
 
27
本程式說明:
28
 
326 liveuser 29
加密任何POST的內容與session資訊,印出json結果.
317 liveuser 30
 
31
*/
32
 
33
#使用命名空間qbpwcf
34
namespace qbpwcf;
35
 
36
#初始化輸出
37
$output=array();
38
 
39
#取得 lib path
40
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../../../../bin/libexec/folderOfUsrLib.php"),$output,$status);
41
 
42
#如果執行失敗
43
if($status!==0){
44
 
45
	#debug
46
	var_dump(__LINE__,$output);
47
 
48
	#結束執行,回傳shell 1.
49
	exit(1);
50
 
51
	}#if end
52
 
53
#儲存lib path
54
$folderOfUsrLib=$output[0];
55
 
56
#初始化輸出
57
$output=array();
58
 
59
#以該檔案的實際位置的 lib path 為 include path 首位
60
exec("cd ".pathinfo(__FILE__)["dirname"]."/../../../../".$folderOfUsrLib."/qbpwcf;pwd;",$output,$status);
61
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
62
 
63
#關閉既有session
64
session_abort();
65
 
66
#設置session儲存位置
67
session_save_path(".hta-session");
68
 
69
#匯入套件
70
require_once("allInOneForJson.php");
71
 
72
#建議的log位置
73
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
74
 
75
#啟動 session
76
session_start();
77
 
78
#記錄開始時間
79
$_SESSION["start"]=time();
80
 
81
#取得session id
82
$sId=session_id();
83
 
84
#初始化 sendMailAgent 的 session
85
$_SESSION["sendMailAgent"]=array();
86
 
87
#函式說明:
88
#依照OPTIONS的要求,判斷條件,給予允許呼叫的header。
89
#回傳結果:
90
#$result["status"],執行是否成功,"true"代表成功,"false"代表不成功.
91
#$result["function"],當前執行的函數名稱.
92
#$result["error"],錯誤訊息陣列.
93
#$result["content"],回傳結果.
94
#$result["content"]["receivedHeader"],陣列,收到的header
95
#$result["content"]["sendedHeader"],陣列,要送出的header.
96
#必填參數:
97
#無
98
#可省略參數:
99
#$conf["allowDomain"],陣列變數,代表允許的來源domain name.
100
#$conf["allowDomain"]=array();
101
#$conf["allowMethod"],陣列變數,代表允許的要求方法.
102
#$conf["allowMethod"]=array();
103
#$conf["allowHeader"],陣列變數,代表要允許的header.
104
#$conf["allowHeader"]=array();
105
#參考資料:
106
#https://www.php.net/manual/en/function.header-remove.php
107
#https://www.php.net/manual/en/function.http-response-code.php
108
#備註:
109
#無.
110
$conf=array();
111
$accessControl=header::accessControl($conf);
112
unset($conf);
113
 
114
#如果執行失敗
115
if($accessControl["status"]==="false"){
116
 
117
	#函式說明:
118
	#撰寫log
119
	#回傳結果:
120
	#$result["status"],狀態,"true"或"false".
121
	#$result["error"],錯誤訊息陣列.
122
	#$result["function"],當前函式的名稱.
123
	#$result["argu"],使用的參數.
124
	#必填參數:
125
	#$conf["path"],字串,log檔案的路徑與名稱.
126
	$conf["path"]=$logFile;
127
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
128
	$conf["content"]=$accessControl;
129
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
130
	$conf["fileArgu"]=__FILE__;
131
	#可省略參數:
132
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
133
	#$conf["rewrite"]="false";
134
	#參考資料:
135
	#無.
136
	#備註:
137
	#無.
138
	$record=logs::record($conf);
139
	unset($conf);
140
 
141
	#如果寫log失敗
142
	if($record["status"]==="false"){
143
 
144
		#印出json結果
145
		echo json_encode($record);
146
 
147
		}#if end
148
 
149
	#結束執行,回傳錯誤代碼1
150
	exit(1);
151
 
152
	}#if end
153
 
154
#函式說明:
155
#可以處理多個透過GET、POST而來的資訊,儲存成變數,同時限定傳送的方法、來源,來增加安全性,檢查有沒有皆收到必須要接收到的變數,沒有接收到的變數可以指定從session變數中取得.
156
#回傳結果:
157
#$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
158
#$result["error"],錯誤訊息陣列.
159
#$resutl["function"],當前執行的函式名稱.
160
#$result["warning"],警告訊息陣列.
161
#$result["passed"],是否有皆收到全部該接收到的變數,若有設定$conf["checkedVarName"]的話,執行正常後會回傳該結果。
162
#$result["lostVarName"],沒有皆收到的變數名稱陣列
163
#$result["inputDataContent"],所接收的參數陣列.
164
#$result["inputDataContent"]["變數名稱"],所接收變數的內容.
165
#$result["inputDataCount"],從表單總共接收到幾個元素.
166
#$result["HTTP_REFERER"],前一頁的網址,null代表不存在.
167
#必填參數:
168
#$conf["method"],字串,傳送過來的資料是用"post/POST"還是"get/GET"?
169
$conf["method"]="POST";
170
#可省略參數:
171
#$conf["allowGet"],字串,是否要允許 get 傳值,"true",代表允許;"false" ,代表不允許,預設爲不允許.
172
#$conf["allowGet"]="true";
173
#$conf["limitPrePage"],字串陣列,是否要限定前一頁的網址為哪些,才能接收內容,不符合則轉址.
174
#$conf["limitPrePage"]=array("");
175
#$conf["transferLocation"],字串,遇到get傳值,或前一個頁面不符合要求時要轉址到的頁面,預設爲資安素養網"https://isafe.moe.edu.tw/"
176
#$conf["transferLocation"]="";
177
#$conf["ignore"]=字串陣列,如果要接收的變數名稱與該陣列其一元素一樣,則不放進要回傳的變數裏面.
178
#$conf["ignore"]=array();
179
#$conf["correctCharacter"]=,字串,如果爲"false",則不處理可能導致網頁出問題的字串,預設爲要進行處理.
180
#$conf["correctCharacter"]="false";
181
#$conf["checkedVarName"],字串陣列,為檢查是否有接收到哪些變數.
182
#$conf["checkedVarName"]=array("email");
183
#$conf["canBeEmptyString"],字串,用$conf["checkedVarName"]指定接收的變數名稱陣列,若接收到的內容為空字串是否算有接收到內容,預設為"false","true"代表接收到的內容可以為空字串,"false"代表接收到的內容不可以為空字串.
184
#$conf["canBeEmptyString"]="false";
185
#$conf["sessionNameArray"],陣列,若存在則代表若沒有從表單取得變數,則從session變數中取得內容,每個元素代表每個表單變數對應的session名稱,若不是要改用session方式取得變數內容的變數,請輸入null,數量請跟$conf["checkedVarName"]參數一致.
186
#$conf["sessionNameArray"]=array("sendMailAgentAPIkey");
187
#$conf["unsetSessionArray"],陣列,與$conf["sessionNameArray"]對應的元素,是否要接收到變數後就卸除,"true"代表要卸除,"false"代表不要卸除.
188
#$conf["unsetSessionArray"]=array("true");
189
#$conf["recaptcha_url"],字串,有內容代表要檢查有無透過recaptcha於特定頁面網址認證過.
190
#$conf["recaptcha_url"]="";
191
#參考資料:
192
#foreach 的用法 -> http://php.net/manual/en/control-structures.foreach.php
193
#伺服器端的變數 -> http://php.net/manual/en/reserved.variables.server.php
194
#備註:
195
#表單變數的名稱若含有「.」,則會變成「-」。
196
$responseMultiInputDataSecurityEnhance=form::responseMultiInputDataSecurityEnhance($conf);
197
unset($conf);
198
 
199
#如果執行失敗
200
if($responseMultiInputDataSecurityEnhance["status"]==="false"){
201
 
202
	#函式說明:
203
	#撰寫log
204
	#回傳結果:
205
	#$result["status"],狀態,"true"或"false".
206
	#$result["error"],錯誤訊息陣列.
207
	#$result["function"],當前函式的名稱.
208
	#$result["argu"],使用的參數.
209
	#必填參數:
210
	#$conf["path"],字串,log檔案的路徑與名稱.
211
	$conf["path"]=$logFile;
212
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
213
	$conf["content"]=$accessControl;
214
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
215
	$conf["fileArgu"]=__FILE__;
216
	#可省略參數:
217
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
218
	#$conf["rewrite"]="false";
219
	#參考資料:
220
	#無.
221
	#備註:
222
	#無.
223
	$record=logs::record($conf);
224
	unset($conf);
225
 
226
	#如果寫log失敗
227
	if($record["status"]==="false"){
228
 
229
		#印出json結果
230
		echo json_encode($record);
231
 
232
		}#if end
233
 
234
	#結束執行,回傳錯誤代碼1
235
	exit(1);
236
 
237
	}#if end
238
 
239
#如果驗證失敗
240
if($responseMultiInputDataSecurityEnhance["passed"]==="false"){
241
 
242
	#函式說明:
243
	#撰寫log
244
	#回傳結果:
245
	#$result["status"],狀態,"true"或"false".
246
	#$result["error"],錯誤訊息陣列.
247
	#$result["function"],當前函式的名稱.
248
	#$result["argu"],使用的參數.
249
	#必填參數:
250
	#$conf["path"],字串,log檔案的路徑與名稱.
251
	$conf["path"]=$logFile;
252
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
253
	$conf["content"]=$accessControl;
254
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
255
	$conf["fileArgu"]=__FILE__;
256
	#可省略參數:
257
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
258
	#$conf["rewrite"]="false";
259
	#參考資料:
260
	#無.
261
	#備註:
262
	#無.
263
	$record=logs::record($conf);
264
	unset($conf);
265
 
266
	#如果寫log失敗
267
	if($record["status"]==="false"){
268
 
269
		#印出json結果
270
		echo json_encode($record);
271
 
272
		}#if end
273
 
274
	#結束執行,回傳錯誤代碼1
275
	exit(1);
276
 
277
	}#if end
278
 
279
#函式說明:
280
#建立以圖片(PNG格式)呈現的驗證碼.
281
#回傳的解果:
282
#$result["status"],執行是否正常,"true"代表執行成功,"false"代表執行失敗.
283
#$result["error"],錯誤訊息.
284
#$result["function"],檔前執行的函數名稱.
285
#$result["randNumberWord"],傳驗證碼的內容.
286
#$result["imgAddress"],包含src圖片的位置與名稱.
287
#$result["imgSrcVal"],放在src裏面的圖片位置與名稱.
288
#必填參數:
289
#$conf["imgAddressAndName"],字串,爲驗證碼圖片儲存的位置與名稱,副檔名程式會自動產生
290
$conf["imgAddressAndName"]="/tmp/notExsit.img";
291
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
292
$conf["fileArgu"]=__FILE__;
293
#可省略參數:
294
#$conf["num"],字串,爲驗證碼的位數,請輸入阿拉伯數字,預設為"8"位數.
295
#$conf["num"]="8";
296
#$conf["disableImg"],字串,是否要取消驗證碼圖片的輸出,"true"為要取消,預設為"false"為不取消
297
$conf["disableImg"]="true";
298
#$conf["imgToData"],字串,預設為"true"代表將圖片轉存成base64圖片,並將原始圖片移除;反之為"false"
299
#$conf["imgToData"]="true";
300
#$conf["class"],字串,圖片要套用的css樣式類別.
301
#$conf["class"]="";
302
#$conf["content"],字串陣列,允許的亂數陣列內容,預設爲(1~9 and A~Z).
303
#$conf["content"]=array();
304
#參考資料:
305
#無.
306
#備註:
307
#無.
308
$validationCode=authenticate::validationCode($conf);
309
unset($conf);
310
 
311
#如果執行失敗
312
if($validationCode["status"]==="false"){
313
 
314
	#函式說明:
315
	#撰寫log
316
	#回傳結果:
317
	#$result["status"],狀態,"true"或"false".
318
	#$result["error"],錯誤訊息陣列.
319
	#$result["function"],當前函式的名稱.
320
	#$result["argu"],使用的參數.
321
	#必填參數:
322
	#$conf["path"],字串,log檔案的路徑與名稱.
323
	$conf["path"]=$logFile;
324
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
325
	$conf["content"]=$validationCode;
326
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
327
	$conf["fileArgu"]=__FILE__;
328
	#可省略參數:
329
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
330
	#$conf["rewrite"]="false";
331
	#參考資料:
332
	#無.
333
	#備註:
334
	#無.
335
	$record=logs::record($conf);
336
	unset($conf);
337
 
338
	#如果寫log失敗
339
	if($record["status"]==="false"){
340
 
341
		#印出json結果
342
		echo json_encode($record);
343
 
344
		}#if end
345
 
346
	#結束執行,回傳錯誤代碼1
347
	exit(1);
348
 
349
	}#if end
350
 
351
#隨機產生get變數名稱
352
$getVarName=$validationCode["randNumberWord"];
353
 
354
#取得未加密的get變數
355
$plainGetVar=$getVarName."=".$sId;
356
 
357
#debug
358
#var_dump(__LINE__,$plainGetVar);
359
 
360
#用GnuPG加密 get 變數 - start
361
 
362
#函式說明:
363
#加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.
364
#回傳結果:
365
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
366
#$result["function"],當前執行的函數名稱.
367
#$result["content"],加密後的結果.
368
#$result["error"],錯誤訊息陣列.
369
#$result["argu"],使用的參數.
370
#必填參數:
371
#$conf["enCodeStr"],any,要加密的字串,陣列,物件.
372
$conf["enCodeStr"]=$plainGetVar;
373
#$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.
374
$conf["enCodeType"]="gpg";
375
#可省略參數:
376
#$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".
377
#$conf["sha1Raw"]="false";
378
#$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.
379
#$conf["p_hash"]="";
380
#$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.
381
#$conf["keyForAes256"]="";
382
#$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.
383
#$conf["aes256Encode"]="";
384
#$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.
385
#$conf["qbpwcfDecode"]="false";
386
#$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.
387
#$conf["gpgDecrypt"]="false";
388
#$conf["gpgId"],字串,若"enCodeType"為"gpg"時,該參數必填.
389
$conf["gpgId"]=gnupgId;
390
#參考資料:
391
#sha1=>http://php.net/manual/en/function.sha1.php
392
#md5=>http://php.net/manual/en/function.md5.php
393
#password_hash=>http://php.net/manual/en/function.password-hash.php
394
#password_verify=>http://php.net/manual/en/function.password-verify.php
395
#json_decode=>https://www.php.net/manual/en/function.json-decode.php
396
#備註:
397
#無.
398
$enCodeStr=authenticate::enCodeStr($conf);
399
unset($conf);
400
 
401
#如果執行失敗
402
if($writeTextIntoFile["status"]==="false"){
403
 
404
	#函式說明:
405
	#撰寫log
406
	#回傳結果:
407
	#$result["status"],狀態,"true"或"false".
408
	#$result["error"],錯誤訊息陣列.
409
	#$result["function"],當前函式的名稱.
410
	#$result["argu"],使用的參數.
411
	#必填參數:
412
	#$conf["path"],字串,log檔案的路徑與名稱.
413
	$conf["path"]=$logFile;
414
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
415
	$conf["content"]=$enCodeStr;
416
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
417
	$conf["fileArgu"]=__FILE__;
418
	#可省略參數:
419
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
420
	#$conf["rewrite"]="false";
421
	#參考資料:
422
	#無.
423
	#備註:
424
	#無.
425
	$record=logs::record($conf);
426
	unset($conf);
427
 
428
	#如果寫log失敗
429
	if($record["status"]==="false"){
430
 
431
		#印出json結果
432
		echo json_encode($record);
433
 
434
		}#if end
435
 
436
	#結束執行,回傳錯誤代碼1
437
	exit(1);
438
 
439
	}#if end
440
 
441
#取得編碼後的GET變數
442
$encryptedGetVar=$enCodeStr["content"];
443
 
444
#用GnuPG加密 get 變數 - end
445
 
446
#用GnuPG加密 post 變數 - start
447
 
448
#取得收到的 POST 陣列
449
$receivedPOST=$responseMultiInputDataSecurityEnhance["inputDataContent"];
450
 
451
#函式說明:
452
#加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.
453
#回傳結果:
454
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
455
#$result["function"],當前執行的函數名稱.
456
#$result["content"],加密後的結果.
457
#$result["error"],錯誤訊息陣列.
458
#$result["argu"],使用的參數.
459
#必填參數:
460
#$conf["enCodeStr"],any,要加密的字串,陣列,物件.
461
$conf["enCodeStr"]=$receivedPOST;
462
#$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.
463
$conf["enCodeType"]="gpg";
464
#可省略參數:
465
#$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".
466
#$conf["sha1Raw"]="false";
467
#$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.
468
#$conf["p_hash"]="";
469
#$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.
470
#$conf["keyForAes256"]="";
471
#$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.
472
#$conf["aes256Encode"]="";
473
#$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.
474
#$conf["qbpwcfDecode"]="false";
475
#$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.
476
#$conf["gpgDecrypt"]="false";
477
#$conf["gpgId"],字串,若"enCodeType"為"gpg"時,該參數必填.
478
$conf["gpgId"]=gnupgId;
479
#參考資料:
480
#sha1=>http://php.net/manual/en/function.sha1.php
481
#md5=>http://php.net/manual/en/function.md5.php
482
#password_hash=>http://php.net/manual/en/function.password-hash.php
483
#password_verify=>http://php.net/manual/en/function.password-verify.php
484
#json_decode=>https://www.php.net/manual/en/function.json-decode.php
485
#備註:
486
#無.
487
$enCodeStr=authenticate::enCodeStr($conf);
488
unset($conf);
489
 
490
#如果執行失敗
491
if($writeTextIntoFile["status"]==="false"){
492
 
493
	#函式說明:
494
	#撰寫log
495
	#回傳結果:
496
	#$result["status"],狀態,"true"或"false".
497
	#$result["error"],錯誤訊息陣列.
498
	#$result["function"],當前函式的名稱.
499
	#$result["argu"],使用的參數.
500
	#必填參數:
501
	#$conf["path"],字串,log檔案的路徑與名稱.
502
	$conf["path"]=$logFile;
503
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
504
	$conf["content"]=$enCodeStr;
505
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
506
	$conf["fileArgu"]=__FILE__;
507
	#可省略參數:
508
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
509
	#$conf["rewrite"]="false";
510
	#參考資料:
511
	#無.
512
	#備註:
513
	#無.
514
	$record=logs::record($conf);
515
	unset($conf);
516
 
517
	#如果寫log失敗
518
	if($record["status"]==="false"){
519
 
520
		#印出json結果
521
		echo json_encode($record);
522
 
523
		}#if end
524
 
525
	#結束執行,回傳錯誤代碼1
526
	exit(1);
527
 
528
	}#if end
529
 
530
#取得加密後的post內容
531
$encryptedPostVar=$enCodeStr["content"];
532
 
533
#組合要印出的加密&編碼後結果
534
$result=array("sess"=>base64_encode($encryptedGetVar),"post"=>base64_encode($encryptedPostVar));
535
 
536
#印出 json 結果
537
echo json_encode($result);
538
 
539
#記錄開始 encrypt 時間
540
$_SESSION["sendMailAgent"]["encryptTime"]=time();