Subversion Repositories php-qbpwcf

Rev

Rev 3 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 226
Line 1... Line 1...
1
#!/usr/bin/php
1
#!/usr/bin/php
2
<?php
2
<?php
3
 
3
 
4
/*
4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
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
11
    it under the terms of the GNU General Public License as published by
Line 17... Line 17...
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
18
    GNU General Public License for more details.
19
 
19
 
20
    You should have received a copy of the GNU General Public License
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/>.
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
    
22
 
23
*/
23
*/
24
 
24
 
25
#使用命名空間qbpwcf
25
#使用命名空間qbpwcf
26
namespace qbpwcf;
26
namespace qbpwcf;
27
 
27
 
Line 55... Line 55...
55
	#結束執行,回傳shell 1.
55
	#結束執行,回傳shell 1.
56
	exit(1);
56
	exit(1);
57
 
57
 
58
	}#if end
58
	}#if end
59
 
59
 
60
#設置 include path 
60
#設置 include path
61
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
61
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
62
 
62
 
63
#匯入外部套件
63
#匯入外部套件
64
include("allInOne.php");
64
include("allInOne.php");
65
 
65
 
Line 90... Line 90...
90
if($getArgu["count"]>1)
90
if($getArgu["count"]>1)
91
{
91
{
92
	#如果有參數 -h 或 --help
92
	#如果有參數 -h 或 --help
93
	if($getArgu["content"][1]==="-h" || $getArgu["content"][1]==="--help")
93
	if($getArgu["content"][1]==="-h" || $getArgu["content"][1]==="--help")
94
	{
94
	{
95
	
95
 
96
		#印出指南,並結束執行.
96
		#印出指南,並結束執行.
97
		echo basename(__FILE__) . " 用法:".PHP_EOL;
97
		echo basename(__FILE__) . " 用法:".PHP_EOL;
98
		echo basename(__FILE__) . " -h/--help 顯示本說明.".PHP_EOL;
98
		echo basename(__FILE__) . " -h/--help 顯示本說明.".PHP_EOL;
99
		echo basename(__FILE__) . " -logAddr httpd log 的路徑.".PHP_EOL;
99
		echo basename(__FILE__) . " -logAddr httpd log 的路徑.".PHP_EOL;
100
		exit;
100
		exit;
101
	
101
 
102
	}#if end
102
	}#if end
103
 
103
 
104
}#if end
104
}#if end
105
 
105
 
106
#函式說明:
106
#函式說明:
Line 132... Line 132...
132
	#如果有 logAddr 參數
132
	#如果有 logAddr 參數
133
	if(isset($parseArgu["content"]["logAddr"]))
133
	if(isset($parseArgu["content"]["logAddr"]))
134
	{
134
	{
135
		#取得 logAddr 參數
135
		#取得 logAddr 參數
136
		$logAddr=$parseArgu["content"]["logAddr"][0];
136
		$logAddr=$parseArgu["content"]["logAddr"][0];
137
	
137
 
138
	}#if end
138
	}#if end
139
 
139
 
140
}#if end
140
}#if end
141
 
141
 
142
#取得 http 存取記錄的 log
142
#取得 http 存取記錄的 log
Line 183... Line 183...
183
 
183
 
184
	#回傳結果
184
	#回傳結果
185
	return $result;
185
	return $result;
186
 
186
 
187
	}#if end
187
	}#if end
188
	
188
 
189
#如果有找到關鍵字 " 404 "
189
#如果有找到關鍵字 " 404 "
190
if($searchOutPut["founded"]==="true"){
190
if($searchOutPut["founded"]==="true"){
191
 
191
 
192
	#過濾掉對於含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.  	
192
	#過濾掉對於含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.
193
	#函式說明:
193
	#函式說明:
194
	#檢查多個字串中的每個字串是否有多個關鍵字
194
	#檢查多個字串中的每個字串是否有多個關鍵字
195
	#回傳的結果:
195
	#回傳的結果:
196
	#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
196
	#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
197
	#$result["function"],當前執行的函數名稱.
197
	#$result["function"],當前執行的函數名稱.
Line 210... Line 210...
210
	$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
210
	$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
211
	unset($conf["search::findManyKeyWordsFromManyString"]);
211
	unset($conf["search::findManyKeyWordsFromManyString"]);
212
 
212
 
213
	#如果執行出錯
213
	#如果執行出錯
214
	if($findManyKeyWordsFromManyString["status"]==="false"){
214
	if($findManyKeyWordsFromManyString["status"]==="false"){
215
		
215
 
216
		#設置執行失敗
216
		#設置執行失敗
217
		$result["status"]="false";
217
		$result["status"]="false";
218
 
218
 
219
		#設置錯誤訊息
219
		#設置錯誤訊息
220
		$result["error"]=$findManyKeyWordsFromManyString;
220
		$result["error"]=$findManyKeyWordsFromManyString;
221
 
221
 
222
		#回傳結果
222
		#回傳結果
223
		return $result;
223
		return $result;
224
		
224
 
225
		}#if end	
225
		}#if end
226
		
226
 
227
	#取得不含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.
227
	#取得不含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.
228
	$searchOutPut["content"]=$findManyKeyWordsFromManyString["foundedFalseKey"];	
228
	$searchOutPut["content"]=$findManyKeyWordsFromManyString["foundedFalseKey"];
229
 
229
 
230
	#更新計數
230
	#更新計數
231
	$searchOutPut["count"]=count($searchOutPut["content"]);
231
	$searchOutPut["count"]=count($searchOutPut["content"]);
232
 
232
 
233
	#針對每列輸出
233
	#針對每列輸出
Line 249... Line 249...
249
		#$result["statusCode"],執行結束後的代碼.
249
		#$result["statusCode"],執行結束後的代碼.
250
		#必填的參數
250
		#必填的參數
251
		#$conf["command"],字串,要執行的指令與.
251
		#$conf["command"],字串,要執行的指令與.
252
		$conf["command"]="parse";
252
		$conf["command"]="parse";
253
		#$conf["fileArgu"],字串,變數__FILE__的內容.
253
		#$conf["fileArgu"],字串,變數__FILE__的內容.
254
		$conf["fileArgu"]=__FILE__;		
254
		$conf["fileArgu"]=__FILE__;
255
		#可省略參數:
255
		#可省略參數:
256
		#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
256
		#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
257
		$conf["argu"]=array($line);
257
		$conf["argu"]=array($line);
258
		#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
258
		#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
259
		#$conf["arguIsAddr"]=array();	
259
		#$conf["arguIsAddr"]=array();
260
		#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
260
		#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
261
		#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
261
		#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
262
		#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
262
		#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
263
		#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
263
		#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
264
		#$conf["enablePrintDescription"]="true";
264
		#$conf["enablePrintDescription"]="true";
Line 283... Line 283...
283
		#參考資料:
283
		#參考資料:
284
		#exec=>http://php.net/manual/en/function.exec.php
284
		#exec=>http://php.net/manual/en/function.exec.php
285
		#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
285
		#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
286
		#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
286
		#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
287
		$callShell=external::callShell($conf);
287
		$callShell=external::callShell($conf);
288
		unset($conf);	
288
		unset($conf);
289
		
289
 
290
		#如果執行失敗
290
		#如果執行失敗
291
		if($callShell["status"]==="false"){
291
		if($callShell["status"]==="false"){
292
		
292
 
293
			#印出結果
293
			#印出結果
294
			var_dump($callShell);
294
			var_dump($callShell);
295
		
295
 
296
			#結束執行
296
			#結束執行
297
			exit;
297
			exit;
298
		
298
 
299
			}#if end
299
			}#if end
300
 
300
 
301
		#取得 request ip
301
		#取得 request ip
302
		$ip=$callShell["output"][1];
302
		$ip=$callShell["output"][1];
303
		
303
 
304
		#取得 request addr & method
304
		#取得 request addr & method
305
		$urlAndMethod=$callShell["output"][6];
305
		$urlAndMethod=$callShell["output"][6];
306
		
306
 
307
		#儲存可能有問題的ip
307
		#儲存可能有問題的ip
308
		$ips_byIp[$ip][]=$urlAndMethod;
308
		$ips_byIp[$ip][]=$urlAndMethod;
309
		
309
 
310
		}#foreach end
310
		}#foreach end
311
	
311
 
312
	}#if end	
312
	}#if end
313
	
313
 
314
#取得 httpd 存取記錄的 log
314
#取得 httpd 存取記錄的 log
315
#函數說明:
315
#函數說明:
316
#檢查指令的輸出是否含有關鍵字
316
#檢查指令的輸出是否含有關鍵字
317
#回傳結果:
317
#回傳結果:
318
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
318
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 355... Line 355...
355
 
355
 
356
	#回傳結果
356
	#回傳結果
357
	return $result;
357
	return $result;
358
 
358
 
359
	}#if end
359
	}#if end
360
	
360
 
361
#如果有找到關鍵字 " 404 "
361
#如果有找到關鍵字 " 404 "
362
if($searchOutPut["founded"]==="true"){
362
if($searchOutPut["founded"]==="true"){
363
 
363
 
364
	#過濾掉對於含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.  	
364
	#過濾掉對於含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.
365
	#函式說明:
365
	#函式說明:
366
	#檢查多個字串中的每個字串是否有多個關鍵字
366
	#檢查多個字串中的每個字串是否有多個關鍵字
367
	#回傳的結果:
367
	#回傳的結果:
368
	#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
368
	#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
369
	#$result["function"],當前執行的函數名稱.
369
	#$result["function"],當前執行的函數名稱.
Line 382... Line 382...
382
	$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
382
	$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
383
	unset($conf["search::findManyKeyWordsFromManyString"]);
383
	unset($conf["search::findManyKeyWordsFromManyString"]);
384
 
384
 
385
	#如果執行出錯
385
	#如果執行出錯
386
	if($findManyKeyWordsFromManyString["status"]==="false"){
386
	if($findManyKeyWordsFromManyString["status"]==="false"){
387
		
387
 
388
		#設置執行失敗
388
		#設置執行失敗
389
		$result["status"]="false";
389
		$result["status"]="false";
390
 
390
 
391
		#設置錯誤訊息
391
		#設置錯誤訊息
392
		$result["error"]=$findManyKeyWordsFromManyString;
392
		$result["error"]=$findManyKeyWordsFromManyString;
393
 
393
 
394
		#回傳結果
394
		#回傳結果
395
		return $result;
395
		return $result;
396
		
396
 
397
		}#if end
397
		}#if end
398
		
398
 
399
	#var_dump($findManyKeyWordsFromManyString);exit;	
399
	#var_dump($findManyKeyWordsFromManyString);exit;
400
		
400
 
401
	#取得不含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.
401
	#取得不含有 ".css" ".js" "favicon.ico" ".jpg" ".png" 關鍵字串的結果.
402
	$searchOutPut["content"]=$findManyKeyWordsFromManyString["foundedFalseKey"];	
402
	$searchOutPut["content"]=$findManyKeyWordsFromManyString["foundedFalseKey"];
403
 
403
 
404
	#更新計數
404
	#更新計數
405
	$searchOutPut["count"]=count($searchOutPut["content"]);
405
	$searchOutPut["count"]=count($searchOutPut["content"]);
406
 
406
 
407
	#針對每列輸出
407
	#針對每列輸出
Line 423... Line 423...
423
		#$result["statusCode"],執行結束後的代碼.
423
		#$result["statusCode"],執行結束後的代碼.
424
		#必填的參數
424
		#必填的參數
425
		#$conf["command"],字串,要執行的指令與.
425
		#$conf["command"],字串,要執行的指令與.
426
		$conf["command"]="parse";
426
		$conf["command"]="parse";
427
		#$conf["fileArgu"],字串,變數__FILE__的內容.
427
		#$conf["fileArgu"],字串,變數__FILE__的內容.
428
		$conf["fileArgu"]=__FILE__;		
428
		$conf["fileArgu"]=__FILE__;
429
		#可省略參數:
429
		#可省略參數:
430
		#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
430
		#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
431
		$conf["argu"]=array($line);
431
		$conf["argu"]=array($line);
432
		#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
432
		#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
433
		#$conf["arguIsAddr"]=array();	
433
		#$conf["arguIsAddr"]=array();
434
		#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
434
		#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
435
		#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
435
		#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
436
		#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
436
		#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
437
		#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
437
		#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
438
		#$conf["enablePrintDescription"]="true";
438
		#$conf["enablePrintDescription"]="true";
Line 457... Line 457...
457
		#參考資料:
457
		#參考資料:
458
		#exec=>http://php.net/manual/en/function.exec.php
458
		#exec=>http://php.net/manual/en/function.exec.php
459
		#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
459
		#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
460
		#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
460
		#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
461
		$callShell=external::callShell($conf);
461
		$callShell=external::callShell($conf);
462
		unset($conf);	
462
		unset($conf);
463
		
463
 
464
		#如果執行失敗
464
		#如果執行失敗
465
		if($callShell["status"]==="false"){
465
		if($callShell["status"]==="false"){
466
		
466
 
467
			#印出結果
467
			#印出結果
468
			var_dump($callShell);
468
			var_dump($callShell);
469
		
469
 
470
			#結束執行
470
			#結束執行
471
			exit;
471
			exit;
472
		
472
 
473
			}#if end
473
			}#if end
474
 
474
 
475
		#取得 request ip
475
		#取得 request ip
476
		$ip=$callShell["output"][1];
476
		$ip=$callShell["output"][1];
477
		
477
 
478
		#取得 request addr & method
478
		#取得 request addr & method
479
		$urlAndMethod=$callShell["output"][6];
479
		$urlAndMethod=$callShell["output"][6];
480
		
480
 
481
		#儲存可能有問題的ip
481
		#儲存可能有問題的ip
482
		$ips_byIp[$ip][]=$urlAndMethod;
482
		$ips_byIp[$ip][]=$urlAndMethod;
483
		
483
 
484
		}#foreach end
484
		}#foreach end
485
 
485
 
486
	}#if end	
486
	}#if end
487
	
487
 
488
#針對每個有問題的ip
488
#針對每個有問題的ip
489
foreach($ips_byIp as $ip=>$urls){
489
foreach($ips_byIp as $ip=>$urls){
490
 
490
 
491
	#提示有問題的 ip
491
	#提示有問題的 ip
492
	echo "IP:".$ip." 拜訪過以下位置:".PHP_EOL;
492
	echo "IP:".$ip." 拜訪過以下位置:".PHP_EOL;
493
	
493
 
494
	foreach($urls as $url)
494
	foreach($urls as $url)
495
	{
495
	{
496
		echo $url.PHP_EOL;
496
		echo $url.PHP_EOL;
497
	}
497
	}
498
	
498
 
499
	#提示是否要 block it
499
	#提示是否要 block it
500
	echo "是否要 block it?".PHP_EOL;
500
	echo "是否要 block it?".PHP_EOL;
501
	
501
 
502
	#涵式說明:
502
	#涵式說明:
503
	#讀取標準I/O的一行輸入.並提供提示說明.
503
	#讀取標準I/O的一行輸入.並提供提示說明.
504
	#回傳的結果:
504
	#回傳的結果:
505
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
505
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
506
	#$result["error"],錯誤訊息.
506
	#$result["error"],錯誤訊息.
Line 512... Line 512...
512
	#可省略的參數:
512
	#可省略的參數:
513
	#$conf["newLineBreak"],字串,是否$conf["commentsArray"]的每個元素後面都要斷行,"false"代表不要,預設為"true"要斷行.
513
	#$conf["newLineBreak"],字串,是否$conf["commentsArray"]的每個元素後面都要斷行,"false"代表不要,預設為"true"要斷行.
514
	#$conf["newLineBreak"]="false";
514
	#$conf["newLineBreak"]="false";
515
	$readLine=cmd::readLine($conf);
515
	$readLine=cmd::readLine($conf);
516
	unset($conf);
516
	unset($conf);
517
	
517
 
518
	#如果讀取失敗
518
	#如果讀取失敗
519
	if($readLine["status"]==="false")
519
	if($readLine["status"]==="false")
520
	{
520
	{
521
		#印出結果
521
		#印出結果
522
		var_dump($readLine);
522
		var_dump($readLine);
523
		
523
 
524
		#結束執行
524
		#結束執行
525
		exit;
525
		exit;
526
		
526
 
527
	}#if end
527
	}#if end
528
	
528
 
529
	#取得輸入的內容
529
	#取得輸入的內容
530
	$input=$readLine["content"];
530
	$input=$readLine["content"];
531
	
531
 
532
	#判斷輸入
532
	#判斷輸入
533
	switch($input){
533
	switch($input){
534
		
534
 
535
		#如果輸入 "y"
535
		#如果輸入 "y"
536
		case "y":
536
		case "y":
537
		
537
 
538
			#封鎖該ip
538
			#封鎖該ip
539
			#涵式說明:
539
			#涵式說明:
540
			#呼叫shell依序執行系統命令,並取得回傳的內容.
540
			#呼叫shell依序執行系統命令,並取得回傳的內容.
541
			#回傳的結果:
541
			#回傳的結果:
542
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
542
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 546... Line 546...
546
			#$result["output"],爲執行完每個指令後的輸出陣列.
546
			#$result["output"],爲執行完每個指令後的輸出陣列.
547
			#必填的參數
547
			#必填的參數
548
			#$conf["command"],字串陣列,要執行的指令.
548
			#$conf["command"],字串陣列,要執行的指令.
549
			$conf["external::callShellMulti"]["command"]=array("echo");
549
			$conf["external::callShellMulti"]["command"]=array("echo");
550
			#$conf["fileArgu"],字串,變數__FILE__的內容,預設為當前檔案的路徑與名稱.
550
			#$conf["fileArgu"],字串,變數__FILE__的內容,預設為當前檔案的路徑與名稱.
551
			$conf["external::callShellMulti"]["fileArgu"]=__FILE__;		
551
			$conf["external::callShellMulti"]["fileArgu"]=__FILE__;
552
			#可省略參數:
552
			#可省略參數:
553
			#$conf["argu"],陣字串列,執行各個$conf["command"]時指令搭配的參數,預設為空陣列.
553
			#$conf["argu"],陣字串列,執行各個$conf["command"]時指令搭配的參數,預設為空陣列.
554
			$conf["external::callShellMulti"]["argu"]=array(array($ip,"|","block_ip.sh"));
554
			$conf["external::callShellMulti"]["argu"]=array(array($ip,"|","block_ip.sh"));
555
			#$conf["enablePrintDescription"],字串陣列,執行各個$conf["command"]時是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,其數量須與$conf["command"]的元素數量相同,若只有一個元素,則代表是每個$conf["command"]執行時都用此參數.
555
			#$conf["enablePrintDescription"],字串陣列,執行各個$conf["command"]時是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,其數量須與$conf["command"]的元素數量相同,若只有一個元素,則代表是每個$conf["command"]執行時都用此參數.
556
			#$conf["enablePrintDescription"]=array("false");
556
			#$conf["enablePrintDescription"]=array("false");
Line 567... Line 567...
567
			#備註:
567
			#備註:
568
			#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行.
568
			#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行.
569
			#參考資料:
569
			#參考資料:
570
			#exec=>http://php.net/manual/en/function.exec.php
570
			#exec=>http://php.net/manual/en/function.exec.php
571
			#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
571
			#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
572
			#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php	
572
			#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
573
			$callShellMulti=external::callShellMulti($conf["external::callShellMulti"]);
573
			$callShellMulti=external::callShellMulti($conf["external::callShellMulti"]);
574
			unset($conf["external::callShellMulti"]);
574
			unset($conf["external::callShellMulti"]);
575
		
575
 
576
			#如果執行失敗
576
			#如果執行失敗
577
			if($callShellMulti["status"]==="false"){
577
			if($callShellMulti["status"]==="false"){
578
			
578
 
579
				#設置執行失敗
579
				#設置執行失敗
580
				$result["status"]="false";
580
				$result["status"]="false";
581
 
581
 
582
				#設置錯誤訊息
582
				#設置錯誤訊息
583
				$result["error"]=$callShellMulti;
583
				$result["error"]=$callShellMulti;
584
 
584
 
585
				#回傳結果
585
				#回傳結果
586
				return $result;
586
				return $result;
587
			
587
 
588
				}#if end
588
				}#if end
589
						
589
 
590
			#結束執行
590
			#結束執行
591
			break;
591
			break;
592
		
592
 
593
		#如果輸入 "n"
593
		#如果輸入 "n"
594
		case "n":
594
		case "n":
595
		
595
 
596
			#換下一個ip
596
			#換下一個ip
597
			continue 2;
597
			continue 2;
598
		
598
 
599
			#結束執行
599
			#結束執行
600
			break;
600
			break;
601
			
601
 
602
		#其他輸入內容
602
		#其他輸入內容
603
		default:
603
		default:
604
		
604
 
605
			#換下一個ip
605
			#換下一個ip
606
			continue 2;
606
			continue 2;
607
		
607
 
608
		}#switch end
608
		}#switch end
609
		
609
 
610
	}#foreach end	
610
	}#foreach end
611
 
611
 
612
?>
612
?>