本文整理汇总了PHP中Server::setPort方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::setPort方法的具体用法?PHP Server::setPort怎么用?PHP Server::setPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::setPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ServerPulse
function ServerPulse()
{
$server = new Server();
//Get server address
$server->setAddress($_SERVER['REMOTE_ADDR']);
//Grab input
$server->setPort($_REQUEST["port"]);
$server->setName($_REQUEST["name"]);
$server->setVersion($_REQUEST["version"]);
$server->setPrivateKey($_REQUEST["fingerprint"]);
$server->setMaxClients($_REQUEST["max"]);
$server->setPublic($_REQUEST["public"]);
$server->setPasswordProtected($_REQUEST["passwordProtected"]);
$server->setAllowGuests($_REQUEST["allowGuests"]);
$server->setUserCount($_REQUEST["users"]);
$server->setUserList($_REQUEST["players"]);
$server->setMotd($_REQUEST["motd"]);
$server->setGameMode($_REQUEST["gamemode"]);
//Update (or create) server record
return Server::updateServer($server);
}
示例2: getServerGroups
function getServerGroups()
{
$sql = "SELECT server_group_id, group_name, description FROM gban_server_group ORDER BY group_name ASC";
$this->db->sql_query($sql);
$groups = $this->db->get_array();
$serverGroups = array();
for ($i = 0; $i < count($groups); $i++) {
$serverGroup = new ServerGroup();
$serverGroup->setId($groups[$i]['server_group_id']);
$serverGroup->setName(stripslashes($groups[$i]['group_name']));
$serverGroup->setDescription(stripslashes($groups[$i]['description']));
// Determine the servers associated with this server group
if ($serverGroup->getId() != null) {
$serversQuery = "SELECT server_id, name, ip, port, type, plugin\r\n FROM gban_servers\r\n WHERE server_group_id = '" . $serverGroup->getId() . "'\r\n ORDER BY server_id";
$this->db->sql_query($serversQuery);
$servers = $this->db->get_array();
$serverList = array();
for ($j = 0; $j < count($servers); $j++) {
$server = new Server();
$server->setId($servers[$j]['server_id']);
$server->setName(stripslashes($servers[$j]['name']));
$server->setIp($servers[$j]['ip']);
$server->setPort($servers[$j]['port']);
$server->setType($servers[$j]['type']);
$server->setPlugin($servers[$j]['plugin']);
array_push($serverList, $server);
// Add the server object to the array
}
$serverGroup->setServers($serverList);
}
// Done getting servers associated with this server group
array_push($serverGroups, $serverGroup);
// Add the server object to the array
}
return $serverGroups;
}
示例3: getServerList
public static function getServerList()
{
//Grab connection object
$mysqli = Utility::getSQLConnection();
$sql = "SELECT server_id, address, port, version, name, private_key, key_hash, ";
$sql .= "max_clients, public, password_protected, allow_guests, user_count, ";
$sql .= "user_list, motd, game_mode, last_heartbeat_date, created_date ";
$sql .= "FROM servers ";
$sql .= "WHERE last_heartbeat_date > (NOW() - INTERVAL 8 HOUR) ";
$sql .= "ORDER BY last_heartbeat_date DESC";
//Prepare query to find server
$stmt = $mysqli->prepare($sql);
if ($mysqli->errno) {
trigger_error($mysqli->error, E_USER_ERROR);
}
//Run query
$stmt->execute();
if ($mysqli->errno) {
$stmt->close();
unset($stmt);
trigger_error($mysqli->error, E_USER_ERROR);
}
$stmt->bind_result($serverId, $address, $port, $version, $name, $privateKey, $keyHash, $maxClients, $public, $passwordProtected, $allowGuests, $userCount, $userList, $motd, $gameMode, $lastHeartbeatDate, $createdDate);
$serverList = array();
while ($stmt->fetch()) {
$server = new Server();
//Fill server object
$server->setServerId($serverId);
$server->setAddress($address);
$server->setPort($port);
$server->setVersion($version);
$server->setName($name);
$server->setPrivateKey($privateKey);
$server->setPublicKey($keyHash);
$server->setMaxClients($maxClients);
$server->setPublic($public);
$server->setPasswordProtected($passwordProtected);
$server->setAllowGuests($allowGuests);
$server->setUserCount($userCount);
$server->setUserList($userList);
$server->setMotd($motd);
$server->setGameMode($gameMode);
$server->setLastHeartbeatDate($lastHeartbeatDate);
$server->setCreatedDate($createdDate);
$serverList[] = $server;
}
$stmt->close();
unset($stmt);
return $serverList;
}