mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 15:05:33 +00:00
Disallow weird characters in chat
This commit is contained in:
parent
e43b4e67c6
commit
1935e2bbf7
@ -875,7 +875,7 @@ class Player{
|
|||||||
$this->close("Incorrect protocol", false);
|
$this->close("Incorrect protocol", false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(preg_match('#^[a-zA-Z0-9_]{2,16}$#', $data["username"])){
|
if(preg_match('#[^a-zA-Z0-9_]#', $data["username"]) == 0){
|
||||||
$this->username = $data["username"];
|
$this->username = $data["username"];
|
||||||
$this->iusername = strtolower($this->username);
|
$this->iusername = strtolower($this->username);
|
||||||
}else{
|
}else{
|
||||||
@ -1304,7 +1304,7 @@ class Player{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$message = $data["message"];
|
$message = $data["message"];
|
||||||
if(trim($data["message"]) != ""){
|
if(trim($data["message"]) != "" and preg_match('#[^\\x20-\\xff]#', $message) == 0){
|
||||||
if($message{0} === "/"){ //Command
|
if($message{0} === "/"){ //Command
|
||||||
$this->server->api->console->run(substr($message, 1), $this);
|
$this->server->api->console->run(substr($message, 1), $this);
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user