Ejemplo n.º 1
0
 // *
 // * g e t   S e s s i o n
 // *
 // ********************************
 $sn = $_REQUEST['sn'];
 // check if we got a sn number with our url
 if (empty($sn)) {
     if (!USING_AJAX) {
         require_once get_file_loc('smr.inc');
         create_error('Your browser lost the SN. Try to reload the page!');
     } else {
         exit;
     }
 }
 // do we have such a container object in the db?
 if (!($var = SmrSession::retrieveVar($sn))) {
     if (!USING_AJAX) {
         require_once get_file_loc('smr.inc');
         create_error('Please avoid using the back button!');
     } else {
         exit;
     }
 }
 //used for include if we need a spec game script outside of the game
 $overrideGameID = 0;
 if (isset($var['game_id']) && is_numeric($var['game_id'])) {
     $overrideGameID = $var['game_id'];
 }
 if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) {
     $overrideGameID = $var['GameID'];
 }
Ejemplo n.º 2
0
                        $template->assign('MoveMessage', 'You have just checkmated your opponent, congratulations!');
                        break;
                    case 2:
                        $template->assign('MoveMessage', 'There is no piece in that square.');
                        break;
                    case 3:
                        $template->assign('MoveMessage', 'You cannot end your turn in check.');
                        break;
                    case 4:
                        $template->assign('MoveMessage', 'It is not your turn to move.');
                        break;
                    case 5:
                        $template->assign('MoveMessage', 'The game is over.');
                        break;
                }
            } else {
                //				this.logger.error('Player tried to move from an empty tile: username = '******', x = ' + xIn + ', y = ' + yIn + ', toX = ' + toXIn + ', toY = ' + toYIn);
            }
        } else {
            //			this.logger.error('Player tried to move in an ended game');
            $template->assign('MoveMessage', 'It is not your turn to move.');
        }
    } else {
        $template->assign('MoveMessage', 'This game is over.');
        //		this.logger.error('Player tried to move when it was not their turn: x = ' + xIn + ', y = ' + yIn + ', toX = ' + toXIn + ', toY = ' + toYIn);
    }
} else {
    //	this.logger.error('Player supplied an invalid number: x = ' + xIn + ', y = ' + yIn + ', toX = ' + toXIn + ', toY = ' + toYIn);
}
$var = SmrSession::retrieveVar(SmrSession::$lastSN);
do_voodoo();