Hi,
I have the above problem with amxbans. It worked fine and stopped working, although I did not change anything on the server itself. I tried several things to solve this, but had no luck. The amxbans forum is closed for new registrations, so I cannot ask there.
This issue occurs when I try to view the main-page (view.php or the server list). Viewing the admin_list.php or ban_list.php however works (although it takes ages to generate the ban_list.php)
I also tried to reinstall amxbans, but the same issue comes up once one server added itself to the database.
The folder and error message in the topic is truncated as the length is limited.
Here the full error:
Code:
Fatal error: Maximum execution time of 45 seconds exceeded in /var/www/html/amxbansweb/include/rcon_hl_net.inc on line 311
Spoiler
PHP Code:
<?php
// ************************************************************************ //PHPrcon - PHP script collection to remotely administrate and configure Halflife and HalflifeMod Servers through a webinterface //Copyright (C) 2002 Henrik Beige // //This library is free software; you can redistribute it and/or //modify it under the terms of the GNU Lesser General Public //License as published by the Free Software Foundation; either //version 2.1 of the License, or (at your option) any later version. // //This library is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //Lesser General Public License for more details. // //You should have received a copy of the GNU Lesser General Public //License along with this library; if not, write to the Free Software //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ************************************************************************ // // 2009 by |PJ|ShOrTy // fixed protocol since HL1 Update 2008 // fixed multible packet handling // added special functions to communicate with amxbans plugin // // class Rcon {
var $challenge_number; var $connected; var $server_ip; var $server_password; var $server_port; var $socket;
//Close socket to gameserver function Disconnect() { //close socket @fclose($this->socket); $connected = false;
} //function Disconnect()
//Is there an open connection function IsConnected() { return $this->connected; } //function IsConnected()
private function get_challenge() { if($this->challenge_number == "") { //send request of challenge number $challenge = "\xff\xff\xff\xffchallenge rcon\n"; $buffer = $this->Communicate($challenge);
//If no connection is open if(trim($buffer) == "") { $this->connected = false; return false; } //get challenge number $this->challenge_number = trim(substr($buffer,15)); } } //Get detailed player info via rcon function ServerInfo() { //If there is no open connection return false if(!$this->connected) return $this->connected;
//get server information $status = $this->RconCommand("status");
//If there is no open connection return false //If there is bad rcon password return "Bad rcon_password." if(!$status || trim($status) == "Bad rcon_password.") return $status;
//format global server info $line = explode("\n", $status); $map = substr($line[3], strpos($line[3], ":") + 1); $players = trim(substr($line[4], strpos($line[4], ":") + 1)); $active = explode(" ", $players);
//Get all maps in all directories function ServerMaps($pagenumber = 0) { //If there is no open connection return false if(!$this->connected) return $this->connected;
//Get list of maps $maps = $this->RconCommand("maps *", $pagenumber);
//If there is no open connection return false //If there is bad rcon password return "Bad rcon_password." if(!$maps || trim($maps) == "Bad rcon_password.") return $maps;
//If no connection is open if(trim($buffer) == "") { $this->connected = false; return false; }
//build info array $pos=0; $result["type"] = $this->parse_buffer($buffer,$pos,"bytestr"); $result["version"] = $this->parse_buffer($buffer,$pos,"byte"); $result["name"] = $this->parse_buffer($buffer,$pos,"string"); $result["map"] = $this->parse_buffer($buffer,$pos,"string"); $result["mod"] = $this->parse_buffer($buffer,$pos,"string"); $result["game"] = $this->parse_buffer($buffer,$pos,"string"); $result["appid"] = $this->parse_buffer($buffer,$pos,"short"); $result["activeplayers"] = $this->parse_buffer($buffer,$pos,"byte"); $result["maxplayers"] = $this->parse_buffer($buffer,$pos,"byte"); $result["botplayers"] = $this->parse_buffer($buffer,$pos,"byte"); $result["dedicated"] = $this->parse_buffer($buffer,$pos,"bytestr"); $result["os"] = $this->parse_buffer($buffer,$pos,"bytestr"); $result["password"] = $this->parse_buffer($buffer,$pos,"byte"); $result["secure"] = $this->parse_buffer($buffer,$pos,"byte"); $result["sversion"] = $this->parse_buffer($buffer,$pos,"string"); $result["edf"] = $this->parse_buffer($buffer,$pos,"byte"); switch ($result["edf"]) { case '\x80': // The server's game port # is included $result["port"]= $this->parse_buffer($buffer,$pos,"short"); break; case '\x40': // The spectator port # and then the spectator server name are included $result["specport"]= $this->parse_buffer($buffer,$pos,"short"); $result["specservername"] = $this->parse_buffer($buffer,$pos,"string"); break; case '\x20': // The game tag data string for the server is included [future use] $result["gametagdata"] = $this->parse_buffer($buffer,$pos,"string"); } //return formatted result return $result;
//Get players via info protocoll function Players() { //If there is no open connection return false if(!$this->connected) return $this->connected; //get challenge number if($this->challenge_number == "") { //send request of challenge number $challenge = "\xff\xff\xff\xff\x55\xff\xff\xff\xff"; $buffer = $this->Communicate($challenge);
//If no connection is open if(trim($buffer) == "") { $this->connected = false; return false; }
//Execute rcon command on open socket $fp function RconCommand($command, $pagenumber = 0, $single = true) { //If there is no open connection return false if(!$this->connected) return $this->connected;
//AMXBans function to get the online players with more infos function ServerPlayers() { //If there is no open connection return false if(!$this->connected) return $this->connected;
//get first results from server $buffer = fread ($this->socket, 1); $status = socket_get_status($this->socket);
$max=0; //try to get more results while ($status["unread_bytes"] > 0 && $max <= 2) { //get results from server $end="\xfb\xfb\xfb\xfb"; $buffer .= fread($this->socket, $status["unread_bytes"]); $result .= substr($buffer,5);
//search for the last packet from plugin if(stristr($buffer,$end)!==false) { $result=str_replace($end,"",$result); break; }
//get new socket status $buffer = fread ($this->socket, 1); $status = socket_get_status($this->socket); $max++; }
//return unformatted result return trim($result);
} //function RconCommand ($command)
//Communication between PHPrcon and the Gameserver function Communicate($command) { //If there is no open connection return false if(!$this->connected) return $this->connected;
//write command on socket if($command != "") fputs($this->socket, $command, strlen($command));
//get results from server $buffer = fread ($this->socket, 1); $status = socket_get_status($this->socket);
//If there is another package waiting if(substr($buffer, 0, 4) == "\xfe\xff\xff\xff") { //get requestid from split packages $requestid=substr($buffer,4,4);
//get number of packages $po=ord(substr($buffer,8,1)); $panum=($po & 1) + ($po & 2) + ($po & 4) + ($po & 8);
//get number from current package $po=$po >> 4; $pacur=($po & 1) + ($po & 2) + ($po & 4) + ($po & 8);
//add the first package to the array if($pacur==($panum-1)) { $splitbuffer[$pacur]=substr($buffer,9); } else { $splitbuffer[$pacur]=substr($buffer,14); }
//get all missing packages, the fist one we have, so start with 1 for ($i=1;$i<$panum;$i++) { //get next package $buffer2 = fread ($this->socket, 1); $status = socket_get_status($this->socket); $buffer2 .= fread($this->socket, $status["unread_bytes"]);
//get number from current package $requestid2=substr($buffer,4,4); $po=ord(substr($buffer2,8,1)); $po=$po >> 4; $pacur=($po & 1) + ($po & 2) + ($po & 4) + ($po & 8);
//check the requestid from every package and add to array if($requestid==$requestid2) { if($pacur==($panum-1)) { $splitbuffer[$pacur]=substr($buffer2,9); } else { $splitbuffer[$pacur]=substr($buffer2,14); } } } //add to main packet, the array is ordered by package num for($i=0;$i<$panum;$i++) $bufferret.=$splitbuffer[$i]; }
//In case there is only one package else $bufferret = substr($buffer, 4);
//return complete package including the type byte return $bufferret;
} //function Communicate($buffer)
}
?>
I have marked line 311 and added the file as an attachment. Any help would be appreciated.