From 981af305085c3f31cc80ec5c22c79ebc3a3aec95 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Wed, 31 Oct 2007 10:45:28 +0100 Subject: BUGFIX: no check for a followup game if someone else already started one several people could start a followup game (or one person hitting reload) and several games were started. Now the prog checks if there is already an active game. --- index.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'index.php') diff --git a/index.php b/index.php index 2a688fd..f6e2d57 100644 --- a/index.php +++ b/index.php @@ -85,6 +85,23 @@ else if(myisset("new")) $session = DB_get_session_by_gameid($followup); $ruleset = DB_get_ruleset_by_gameid($followup); /* just copy ruleset from old game, this way no manipulation is possible */ + + /* check if there is a game in pre or play mode, in that case do nothing */ + if( DB_is_session_active($session) > 0 ) + { + echo "

There is already a game going on in session $session, you can't start a new one

"; + output_footer(); + DB_close(); + exit(); + } + else if ( DB_is_session_active($session) < 0 ) + { + echo "

ERROR: status of session $session couldn't be determined.

"; + output_footer(); + DB_close(); + exit(); + } + if($session) mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1',NULL,'pre',". "'$ruleset','$session' ,NULL)"); -- cgit v1.2.3-18-g5258