Skip to content

Commit

Permalink
Added #1142 OP players can bypass the player limit
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Feb 11, 2014
1 parent 8b23568 commit c09bc25
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,10 @@ public function handleDataPacket(RakNetDataPacket $packet){
if($this->loggedIn === true){
break;
}
$this->username = $packet->username;
$this->iusername = strtolower($this->username);
$this->loginData = array("clientId" => $packet->clientId, "loginData" => $packet->loginData);
if(count($this->server->clients) > $this->server->maxClients){
if(count($this->server->clients) > $this->server->maxClients and !$this->server->api->ban->isOp($this->iusername)){
$this->close("server is full!", false);
return;
}
Expand All @@ -1307,16 +1309,11 @@ public function handleDataPacket(RakNetDataPacket $packet){
$this->directDataPacket($pk);
}
$this->close("Incorrect protocol #".$packet->protocol1, false);
break;
return;
}
if(preg_match('#[^a-zA-Z0-9_]#', $packet->username) == 0 and $packet->username != ""){
$this->username = $packet->username;
$this->iusername = strtolower($this->username);
}else{
$this->username = $packet->username;
$this->iusername = strtolower($this->username);
if(preg_match('#[^a-zA-Z0-9_]#', $packet->username) > 0 or $packet->username === ""){
$this->close("Bad username", false);
break;
return;
}
if($this->server->api->handle("player.connect", $this) === false){
$this->close("Unknown reason", false);
Expand Down

0 comments on commit c09bc25

Please sign in to comment.