dishadcruze Posted March 23, 2018 Share Posted March 23, 2018 I have a small online question and answer game. In which once a leader starts games, on particular time duration it goes on till he exits from the game. But when the leader's screen is inactive (both in mobile and laptop as well) / locked, the game stops, it doesn't work. How can i overcome this problem?i have not used cookies so far. is the cookies solve my problem? or any other way please suggest Quote Link to comment Share on other sites More sharing options...
dalecosp Posted March 23, 2018 Share Posted March 23, 2018 Don't lock your screen? I'm not sure you've given much of the needed information. What does "the game stops" mean? "It doesn't work" is rather nebulous. Are error message produced? If the screen is unlocked, does the game resume? Is this game written in PHP? If not ... are you in the correct forum? Quote Link to comment Share on other sites More sharing options...
requinix Posted March 24, 2018 Share Posted March 24, 2018 PHP doesn't care if the user's computer is locked. Javascript doesn't care if the user's computer is locked. So what are you using? Quote Link to comment Share on other sites More sharing options...
dishadcruze Posted March 24, 2018 Author Share Posted March 24, 2018 i am using php and mysql. 1. Leader starts the game, a flag is set to 1 in database and players will see the questions (Only this needs Leader's click) 2. After 40 seconds, result will open in leader's side and the result flag will set to 1 and players will see the result. 3. After 40 seconds, it will go back to questions and same thing happens Leader will just starts the game and his work is done. Till he exists the game, it should be running. Here if the leader is inactive , the flag won't set and player have to wait till leader is active. I don't know how to overcome this Quote Link to comment Share on other sites More sharing options...
kicken Posted March 24, 2018 Share Posted March 24, 2018 The problem your having shouldn't exist, so you'll probably have to start showing some code to get any help. For starters, how are you doing your timing? The only way your issue makes sense would be if you're doing the timing on the leader's browser using javascript and their machine ends up going to sleep. Just having the screen-saver / lock screen activate shouldn't cause any problems. Quote Link to comment Share on other sites More sharing options...
dishadcruze Posted March 24, 2018 Author Share Posted March 24, 2018 Yeah, i am using javascript to submit form to set flag in leader's end like this <script type="text/javascript"> $(function(){ // document.ready function... setTimeout(function(){ $('#FrmID').submit(); },3000); }); </script> And in result page header( "refresh:25;url=play_game.php?id=".$grp_id."" ); Quote Link to comment Share on other sites More sharing options...
dishadcruze Posted March 24, 2018 Author Share Posted March 24, 2018 @ kicken Can i PM my code to you? i have replaced header( "refresh:25...." ); instead of javascript. Still the problem is same. even in mobile also it happens the same. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.