飞飞世界论坛

标题: 无bug在线人数代码 [打印本页]

作者: admin    时间: 2016-1-10 03:42
标题: 无bug在线人数代码
In the past I've seen various ways of checking the current number of online players, but all that I've seen have a fatal flaw. Depending on how the server was turned off (or more specifically, if it crashes) the player count gets messed up. Here's the one I'm talking about:
- i2 z6 N4 I7 g9 i& A% HCode:" [4 a3 n9 n1 [+ e4 U4 b" Y8 L
$mssql = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE isuse='J'");
! E. S, c6 i$ a  e/ S8 necho mssql_num_rows($mssql);Here's a more proper code, which will automatically reset the current online count whenever the world server program is opened:/ v8 _  r. O1 F
Code:- x  w2 }& A. _9 L  w' I( z5 q
$mssql = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE MultiServer='1'");0 g, Q" W6 X% d/ J) G  Z9 A& m
echo mssql_num_rows($mssql);" W( F+ Q& ^; L& @! t: C5 G7 |: D

" S4 i/ G' O( Q! B0 [; U6 v, [




欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2