javascript - Pokergame with PHP and Jquery - Browser-Back-Button behaviour -


for practicing reasons programmed little texas holdem game in php jquery animations. every action (bet, fold, check, raise, call) submitted via html form php script.

now unfortunately user able go first betting round after seeing whole board , computer's cards , adjusting betting structure accordingly using back-ubtton of browser.

is there practical way me prevent this?

thanks, coffeehouse

ps:

a buttonscript example this:

if (isset($_post['call']) , $_session['bettingcap'] == 1){     $_session['kapitalspieler'] -= $smallbet; // deduct money player     $_session['pot'] += $smallbet; // add pot     $_session['bettingcap'] = 0; // after call go next street, cap 0     $_session['buttonmodus']=1; // want show buttons     $_session['whichstreet']=$_session['whichstreet']+1; // go next street     $_session['animateagain']='yes'; // show jquery animation  } 

you need invalidate request. means 1 request follows after other.

you storing requests of user in game.

if new request send, can added @ end.

you can create game in memory initializing , pass in events sides until specific one.

this model allow prevent cheating re-playing game in view mode of previous games.

  • 00 created game id:#7575
  • 01 player joined seat:1; id:#12
  • 02 player joined seat:2; id:#56
  • 03 player joined seat:3; id:#87
  • 04 deck shuffled order:the cards order here.
  • 05 ...

so keep these events , if new request send user can check if okay current situation or not.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -