-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathaction.php
More file actions
28 lines (27 loc) · 708 Bytes
/
Copy pathaction.php
File metadata and controls
28 lines (27 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require( dirname(__FILE__).'/game.php' );
$action_check = array('opened','move');
$action = $_GET['action'];
if (!in_array($action, $action_check)) {
die('Illegal request');
}
switch($action) {
case 'opened':
$game_key = $_REQUEST['g'];
$game = Game::get_by_key_name($game_key);
$game_updater_instance = new GameUpdater($game);
$game_updater_instance->send_update();
break;
case 'move':
$game_key = $_REQUEST['g'];
$game = Game::get_by_key_name($game_key);
$user = $_COOKIE['u'];
if ($game and $user) {
$id = $_REQUEST['i'];
$game_updater_instance = new GameUpdater($game);
$game_updater_instance->make_move($id,$user);
}
break;
default:
die('Illegal request');
}