mirror of
https://github.com/ZeroDream-CN/PHPMC7
synced 2025-02-20 06:33:18 +08:00
修复启动命令不支持 + 的问题
This commit is contained in:
parent
4a2dedde78
commit
732a9add7f
@ -291,7 +291,7 @@ class Event {
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.]+$/", $data['jar'])) {
|
||||
PHPMC::Error()->Println("请填写字段:核心文件名字,只能包含英文大小写、数字、_、. 和 -");
|
||||
}
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\= ]+$/", $data['startcommand'])) {
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\=\+ ]+$/", $data['startcommand'])) {
|
||||
PHPMC::Error()->Println("请填写字段:核心启动命令");
|
||||
}
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['stopcommand'])) {
|
||||
@ -339,8 +339,10 @@ class Event {
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.]+$/", $data['jar'])) {
|
||||
PHPMC::Error()->Println("请填写字段:核心文件名字,只能包含英文大小写、数字、_、. 和 -");
|
||||
}
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\= ]+$/", $data['startcommand'])) {
|
||||
PHPMC::Error()->Println("请填写字段:核心启动命令");
|
||||
// 改为黑名单机制 charBlackList
|
||||
// preg_match("/^[A-Za-z0-9\-\_\.\{\}\:\/\\\=\+ ]+$/", $data['startcommand'])
|
||||
if(!$this->charBlackList($data['startcommand'])) {
|
||||
PHPMC::Error()->Println("请填写字段:核心启动命令: {$data['startcommand']}");
|
||||
}
|
||||
if(!preg_match("/^[A-Za-z0-9\-\_\.\{\} ]+$/", $data['stopcommand'])) {
|
||||
PHPMC::Error()->Println("请填写字段:停止命令");
|
||||
@ -375,6 +377,16 @@ class Event {
|
||||
exit;
|
||||
}
|
||||
|
||||
public function charBlackList($str) {
|
||||
$list = Array("'", ">", "<", "&", "|");
|
||||
foreach($list as $char) {
|
||||
if(mb_stristr($str, $chat)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteServerEvent($data) {
|
||||
if(!preg_match("/^[0-9]+$/", $data['id'])) {
|
||||
PHPMC::Error()->Println("请填写字段:服务器 ID");
|
||||
|
Loading…
Reference in New Issue
Block a user