Commit 214f51b8 authored by hisuinohoshi's avatar hisuinohoshi

update roommng2.1

变化:
- 相同IP最多只能同时创建2个房间;
parent 2b1d67e7
......@@ -166,6 +166,9 @@ $rsgame_bots = 4;
//房间数量上限
$max_rooms = 15;
//相同ip最多可创建房间数量:
$ip_max_rooms = 2;
//重登陆时是否自动退出房间(1:自动退出 0:不自动退出)
$login_exit_room = 0;
......
......@@ -49,7 +49,7 @@ function roommng_verify_db_game_structure()
function roommng_create_new_room(&$udata)
{
global $db,$gtablepre,$now;
global $startmin,$max_rooms;
global $startmin,$max_rooms,$ip_max_rooms;
if(!empty($udata['roomid']))
{
......@@ -57,6 +57,14 @@ function roommng_create_new_room(&$udata)
return;
}
# 根据IP判断是否可新建房间
$ipresult = $db->query("SELECT roomid FROM {$gtablepre}users WHERE roomid>0 AND ip='{$udata['ip']}'");
if($db->num_rows($ipresult) >= $ip_max_rooms)
{
echo "相同IP最多只能创建{$ip_max_rooms}个房间。请先解散其他房间。<br>";
return;
}
# 统计当前已新建房间数量
$result = $db->query("SELECT * FROM {$gtablepre}game WHERE groomid>0 ");
$now_room_nums = $db->num_rows($result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment