Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
phpdts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nemo Ma
phpdts
Commits
214f51b8
Commit
214f51b8
authored
Apr 02, 2023
by
hisuinohoshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update roommng2.1
变化: - 相同IP最多只能同时创建2个房间;
parent
2b1d67e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
gamedata/cache/gamecfg_1.php
gamedata/cache/gamecfg_1.php
+3
-0
include/roommng.func.php
include/roommng.func.php
+9
-1
No files found.
gamedata/cache/gamecfg_1.php
View file @
214f51b8
...
...
@@ -166,6 +166,9 @@ $rsgame_bots = 4;
//房间数量上限
$max_rooms
=
15
;
//相同ip最多可创建房间数量:
$ip_max_rooms
=
2
;
//重登陆时是否自动退出房间(1:自动退出 0:不自动退出)
$login_exit_room
=
0
;
...
...
include/roommng.func.php
View file @
214f51b8
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment