URGENT - tables spawn
DONE - spawn of a table
DONE - data to cookies (removed table_idx from xhr calls also)
- closure of a table
- DONE set subst to shutdowner/shutdowned
- DONE return to index.php
+ DONE - set subst to shutdowner/shutdowned
+ DONE - return to index.php
+ DONE - game's token
+ DONE - recover of corrupted table data
- recover of users
- flush of the table (after all recovers we can decide where and how destroy the table)
+ DONE - closure of a table
+ HALF - flush of the table (remove the shm ??)
- game's token
- security checks for right scope access
garbage collector management
+
+ HALF - security checks for right scope access
optimizations
inheritance
var $exitislock; // Player can exit from the table ?
var $table; // id of the current table (if in table state)
var $table_pos; // idx on the table
+ var $table_token;// token that identify a game on a table
var $the_end; // Flag to change the end of the session
function User() {
$thiz->exitislock = TRUE;
$thiz->table = $table;
-
+ $thiz->table_pos = -1;
+ $thiz->table_token = "";
+
return ($thiz);
}
if (($thiz = new User()) == FALSE)
return ($G_false);
- $thiz->name = $from->name;
- $thiz->sess = $from->sess;
- $thiz->ip = $from->ip;
- $thiz->lacc = $from->lacc;
- $thiz->laccwr = $from->laccwr;
- $thiz->bantime = $from->bantime;
- $thiz->stat = $from->stat;
- $thiz->subst = $from->subst;
- $thiz->step = $from->step;
+ $thiz->name = $from->name;
+ $thiz->sess = $from->sess;
+ $thiz->ip = $from->ip;
+ $thiz->lacc = $from->lacc;
+ $thiz->laccwr = $from->laccwr;
+ $thiz->bantime = $from->bantime;
+ $thiz->stat = $from->stat;
+ $thiz->subst = $from->subst;
+ $thiz->step = $from->step;
$thiz->trans_step = $from->trans_step;
- $thiz->comm = array();
+ $thiz->comm = array();
$i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
for ($i = $i_start ; $i < $from->step ; $i++) {
$ii = $i % COMM_N;
- $thiz->comm[$ii] = $from->comm[$ii];
+ $thiz->comm[$ii] = $from->comm[$ii];
}
- $thiz->asta_card = $from->asta_card;
- $thiz->asta_pnt = $from->asta_pnt;
- $thiz->handpt = $from->handpt;
+ $thiz->asta_card = $from->asta_card;
+ $thiz->asta_pnt = $from->asta_pnt;
+ $thiz->handpt = $from->handpt;
$thiz->exitislock = $from->exitislock;
- $thiz->table = $from->table;
- $thiz->table_pos = $from->table_pos;
- $thiz->the_end = $from->the_end;
+ $thiz->table = $from->table;
+ $thiz->table_pos = $from->table_pos;
+ $thiz->table_token = $from->table_token;
+ $thiz->the_end = $from->the_end;
return ($thiz);
}
$thiz->table = $table;
$thiz->table_pos = $table_pos;
+ $thiz->table_token = $from->table_token;
return ($thiz);
}
$table_idx = $user->table;
$table = &$this->table[$table_idx];
- log_main("JOIN_WAKEUP", "begin function table:".$table_idx." stat: ".$user->stat." subst: ".$user->subst);
+ log_main($user->sess, "JOIN_WAKEUP: begin function table:".$table_idx." stat: ".$user->stat." subst: ".$user->subst);
$curtime = time();
-
- log_main("JOIN WAKEUP", "from table [".$user->table."] nplayers_n: ".$this->table[$user->table]->player_n);
+ $user_wup = array();
+ $user_wup_n = 0;
+ log_main($user->sess, "JOIN WAKEUP: from table [".$user->table."] nplayers_n: ".$this->table[$user->table]->player_n);
for ($i = 0 ; $i < $table->player_n ; $i++) {
$user_cur = &$this->user[$table->player[$i]];
- log_main("PREIMPOST", "INLOOP name: ".$user_cur->name);
+ log_main($user->sess, "PREIMPOST INLOOP name: ".$user_cur->name);
if ($user_cur->sess != "") {
$user_cur->laccwr = $curtime;
+ log_load($user->sess, "cur: ".$user_cur->name." subst: ".$user_cur->subst);
if ($user_cur->subst == "shutdowned") {
$user_cur->stat_set("room");
$user_cur->subst = "sitdown";
$user_cur->stat_set("room");
$user_cur->subst = "standup";
$user_cur->table = -1;
- $user_wup = &$user_cur;
+ $user_wup[$user_wup_n++] = &$user_cur;
}
}
}
+ for ($wup_idx = 0 ; $wup_idx < $user_wup_n ; $wup_idx++)
+ $table->user_rem(&$this, &$user_wup[$wup_idx]);
+
/* aggiorna l'array dei giocatori al tavolo. */
- $table->user_rem(&$this, &$user_wup);
for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
+ log_main($user_cur->sess, "START LOOP");
$user_cur = &$this->user[$i];
- if ($user_cur->sess == '' || $user_cur->stat != 'room')
+ if ($user_cur->sess == '' || $user_cur->stat != 'room') {
+ log_main($user_cur->sess, "name: ".$user_cur->name."skip subst: ".$user_cur->subst);
continue;
-
- log_main("VALORI", "name: ".$user_cur->name." tab: ".$user_cur->table." taix: ".$table_idx." ucur: ".$user_cur." us: ".$user);
+ }
+
+ log_main($user->sess, "___");
+ log_main($user->sess, "VALORI name: ".$user_cur->name." tab: ".$user_cur->table." taix: ".$table_idx." ucur: ".$user_cur." us: ".$user);
$ret = "gst.st = ".($user_cur->step+1)."; ";
if ($user_cur->stat == "room") {
- log_main("DOCUMENT.index.php", "from table");
+ log_main($user->sess, "DOCUMENT.index.php from table");
$ret .= table_content($this, $user_cur, $table_idx);
$ret .= standup_content($this, $user_cur);
- $act_content = table_act_content(FALSE, 0, $table_idx, $user->table);
+ $act_content = table_act_content(FALSE, 0, $table_idx, $user_cur->table);
$ret .= sprintf('$("table_act%d").innerHTML = "%s";', $table_idx, $act_content);
-
- if ($user_cur == $user_wup) {
+ for ($wup_idx = 0 ; $wup_idx < $user_wup_n ; $wup_idx++)
+ if ($user_cur == $user_wup[$wup_idx])
+ break;
+
+ log_main($user->sess, "JOIN_WAKEUP wup_idx ".$wup_idx." wup_n ".$user_wup_n);
+
+ if ($wup_idx < $user_wup_n) {
+ log_main($user->sess, "JOIN_WAKEUP less");
// set the new status
$ret .= 'subst = "standup"; ';
// clean the action buttons in other tables
for ($e = 0 ; $e < TABLES_N ; $e++) {
if ($this->table[$e]->player_n < PLAYERS_N)
- $ret .= sprintf('$("table_act%d").innerHTML = "%s";', $e, table_act_content(TRUE, 0, $e, $user->table));
+ $ret .= sprintf('$("table_act%d").innerHTML = "%s";', $e, table_act_content(TRUE, 0, $e, $user_cur->table));
}
+ log_main($user->sess, "JOIN_WAKEUP end less");
}
else {
+ log_main($user->sess, "JOIN_WAKEUP more");
$act_content = table_act_content(($user_cur->subst == 'standup'), $table->player_n, $table_idx, $user_cur->table);
$ret .= sprintf('$("table_act%d").innerHTML = "%s";', $table_idx, $act_content);
+ log_main($user->sess, "JOIN_WAKEUP end more");
}
}
- log_wr($user_cur->sess, "ROOM_JOIN_WAKEUP: ".$ret);
+ log_wr($user->sess, "ROOM_JOIN_WAKEUP: ".$ret);
$user_cur->comm[$user_cur->step % COMM_N] = $ret;
$user_cur->step_inc();
}
var $user;
var $table;
var $table_idx;
+ var $table_token;
+
var $comm; // commands for many people
var $step; // current step of the comm array
var $garbage_timeout;
var $tok;
- function Briskin5 (&$room, $table_idx) {
+ function Briskin5 (&$room, $table_idx, $table_token) {
$this->user = array();
$this->table = array();
log_wr("xxx", "Briskin5 constructor");
- for ($i = 0 ; $i < $table->player_n ; $i++)
+ for ($i = 0 ; $i < $table->player_n ; $i++) {
+ $user[$table->player[$i]]->table_token = $table_token;
$this->user[$i] =& User::spawn(&$user[$table->player[$i]], 0, $i);
-
+ }
$this->table[0] =& Table::spawn(&$table);
$this->table_idx = $table_idx;
+ $this->table_token = $table_token;
$this->garbage_timeout = 0;
log_wr("xxx", "Briskin5 constructor end");
//
// static functions
//
- function &load_data($table_idx)
+ function &load_data($table_idx,$table_token)
{
GLOBAL $G_false, $sess;
$shm = FALSE;
if (($bri = @shm_get_var($shm, $tok)) == FALSE)
break;
+ if ($bri->table_token != $table_token) {
+ log_wr($sess, "bri->table_token: ".$bri->table_token."table_token: ".$table_token);
+
+ break;
+ }
$bri->tok = $tok;
shm_detach($shm);
if ($shm != FALSE)
shm_detach($shm);
+
+ log_wr($sess, "briskin5 load_data failed");
return ($G_false);
}
$shm = FALSE;
$isacq = FALSE;
+ log_main("XXX", "SAVE BRISKIN5 DATA");
// var_dump($bri);
if (!isset($bri->tok))
// var_dump($bri);
+ log_main("XXX", "DESTROY BRISKIN5 DATA");
+
if (!isset($bri->tok))
return (FALSE);
do {
$isacq = TRUE;
- if (($shm = shm_attach($bri->tok, SHM_DIMS)) == FALSE)
+ log_main("XXX", "DESTROY2 BRISKIN5 DATA");
+ if (($shm = shm_attach($bri->tok, SHM_DIMS)) === FALSE)
break;
- if (shm_remove($shm) == FALSE) {
+ if (shm_remove($shm) === FALSE) {
log_only($sess, "REMOVE FALLITA ".strlen(serialize($bri)));
log_only($sess, serialize($bri));
break;
}
+ else {
+ $shm = FALSE;
+ log_main("XXX", "DESTROY2 BRISKIN5 DATA SUCCESS");
+ }
// log_main("XXX", "QUI CI ARRIVA [".$bri->user[0]->name."]");
$ret = TRUE;
} while (0);
{
$table = &$this->table[0];
- log_main("WAKEUP", "begin function table stat: ".$user->stat." subst: ".$user->subst);
+ log_main("BRISKIN5_WAKEUP", "begin function table stat: ".$user->stat." subst: ".$user->subst);
$curtime = time();
- log_main("WAKEUP", "from table [".$user->table."] nplayers_n: ".$this->table[$user->table]->player_n);
+ log_main("BRISKIN5_WAKEUP", "from table [".$user->table."] nplayers_n: ".$this->table[$user->table]->player_n);
for ($i = 0 ; $i < $table->player_n ; $i++) {
$user_cur = &$this->user[$i];
function shutta()
{
- log_rd2("SHUTTA!", connection_status());
+ log_rd2("bin5 SHUTTA!", connection_status());
}
$is_page_streaming = TRUE;
log_rd2("XXX", "UNREC_ERROR");
- return (sprintf('the_end=true; window.onunload = null; document.location.assign("index.php");'));
+ return (sprintf('the_end=true; window.onunload = null; document.location.assign("../index.php");'));
}
function page_sync($sess, $page)
-function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $table_idx)
+function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_subst, &$new_step, $table_idx, $table_token)
{
GLOBAL $is_page_streaming, $first_loop;
$ret = FALSE;
$bri = FALSE;
- log_rd2($sess, "M");
+ // log_rd2($sess, "M");
/* Sync check (read only without modifications */
ignore_user_abort(TRUE);
if (($sem = Briskin5::lock_data($table_idx)) != FALSE) {
// Aggiorna l'expire time lato server
if ($first_loop == TRUE) {
log_only($sess, "F");
- $bri = &Briskin5::load_data($table_idx);
+
+ // VERIFICARE TUTTE LE LOAD_DATA E PRENDERE CONTROMISURE NEL CASO FALLISCANO //
+
+ if (($bri = &Briskin5::load_data($table_idx, $table_token)) == FALSE) {
+ Briskin5::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (unrecerror());
+ }
if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
Briskin5::unlock_data($sem);
ignore_user_abort(FALSE);
else {
return (FALSE);
}
-
+
if (($proxy_step = step_get($sess)) != FALSE) {
// log_rd2($sess, "Postget".$proxy_step."zizi");
-
+
if ($cur_step == $proxy_step) {
log_only2($sess, "P");
return (FALSE);
}
}
else {
- log_only2($sess, "R");
+ log_only2($sess, "R");
}
-
+
if ($bri == FALSE) {
- ignore_user_abort(TRUE);
- if (($sem = Briskin5::lock_data($table_idx)) != FALSE) {
+ do {
+ ignore_user_abort(TRUE);
+ if (($sem = Briskin5::lock_data($table_idx)) == FALSE)
+ break;
+
log_only($sess, "P");
- $bri = &Briskin5::load_data($table_idx);
+ if (($bri = &Briskin5::load_data($table_idx, $table_token)) == FALSE)
+ break;
+ } while (0);
+
+ if ($sem != FALSE)
Briskin5::unlock_data($sem);
- ignore_user_abort(FALSE);
- }
- else {
- return (FALSE);
- }
+
+ ignore_user_abort(FALSE);
+ if ($bri == FALSE)
+ return (unrecerror());
}
if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
// FUNZIONE from_scratch DA QUI
ignore_user_abort(TRUE);
$sem = Briskin5::lock_data($table_idx);
- $bri = &Briskin5::load_data($table_idx);
+ $bri = &Briskin5::load_data($table_idx, $table_token);
if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
Briskin5::unlock_data($sem);
ignore_user_abort(FALSE);
else {
ignore_user_abort(TRUE);
$sem = Briskin5::lock_data($table_idx);
- $bri = &Briskin5::load_data($table_idx);
+ $bri = &Briskin5::load_data($table_idx, $table_token);
if (($user = &$bri->get_user($sess, $idx)) == FALSE) {
Briskin5::unlock_data($sem);
ignore_user_abort(FALSE);
*/
$is_page_streaming = ((stristr($HTTP_USER_AGENT, "linux") &&
- stristr($HTTP_USER_AGENT, "firefox")) ? FALSE : TRUE);
+ (stristr($HTTP_USER_AGENT, "firefox") || stristr($HTTP_USER_AGENT, "iceweasel"))) ? FALSE : TRUE);
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
$myfrom = "";
if (!isset($subst))
$subst = "";
-log_rd2($sess, "FROM OUTSIDE - STAT: ".$stat." SUBST: ".$subst." STEP: ".$step." MYFROM: ".$myfrom. "IS_PAGE:" . $is_page_streaming);
+log_rd2($sess, "FROM OUTSIDE - STAT: ".$stat." SUBST: ".$subst." STEP: ".$step." MYFROM: ".$myfrom. "IS_PAGE:" . $is_page_streaming."USER_AGENT:".$HTTP_USER_AGENT);
$endtime = time() + STREAM_TIMEOUT;
for ($i = 0 ; time() < $endtime ; $i++) {
// log_rd($sess, "PRE MAIN ".$step);;
- if (($ret = maincheck($sess, $old_stat, $old_subst, $old_step, &$stat, &$subst, &$step, $table_idx)) != FALSE) {
+ if (($ret = maincheck($sess, $old_stat, $old_subst, $old_step, &$stat, &$subst, &$step, $table_idx, $table_token)) != FALSE) {
echo '@BEGIN@';
// log_rd2($sess, sprintf("\nSESS: [%s]\nOLD_STAT: [%s] OLD_SUBST: [%s] OLD_STEP: [%s] \nSTAT: [%s] SUBST: [%s] STEP: [%s] \nCOMM: [%s]\n", $sess, $old_stat, $old_subst, $old_step, $stat, $subst, $step, $ret));
echo "$ret";
exit;
$sem = Briskin5::lock_data($table_idx);
-$bri = &Briskin5::load_data($table_idx);
+$bri = &Briskin5::load_data($table_idx,$table_token);
if (($user = &$bri->get_user($sess, &$idx)) == FALSE) {
echo "Get User Error";
log_wr($sess, "Get User Error");
log_rd2($user->sess, "AUTO LOGOUT.");
if ($user->subst == 'sitdown' || $user->stat == 'table')
- $bri->room_wakeup(&$user);
+ $bri->table_wakeup(&$user);
else if ($user->subst == 'standup')
$bri->room_outstandup(&$user);
else
**********************/
else if ($user->subst == 'sitdown') {
if ($argz[0] == 'wakeup') {
- $bri->room_wakeup(&$user);
+ $bri->table_wakeup(&$user);
}
else if ($argz[0] == 'logout') {
- $bri->room_wakeup(&$user);
+ $bri->table_wakeup(&$user);
$user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
$user->comm[$user->step % COMM_N] .= sprintf('postact_logout();');
$user->the_end = TRUE;
function main()
{
- GLOBAL $sess, $name, $table_idx, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
+ GLOBAL $sess, $name, $table_idx, $table_token, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
$body = "";
$tables = "";
$change_page = TRUE;
log_load($sess, "resync from index.php");
- if (isset($table_idx)) {
- $table_idx = (int)$table_idx;
- log_load($sess, "SET TABLE_IDX <yy".$table_idx.">".TABLES_N);
- if ($table_idx >= 0 && $table_idx < TABLES_N) {
- log_load($sess, "SET TABLE_IDX GOOD VALUE");
- $bri_sem = Briskin5::lock_data($table_idx);
- $bri = &Briskin5::load_data($table_idx);
-
- if (($bri_user = &$bri->get_user($sess, &$bri_idx)) != FALSE) {
- if ($bri_user->subst == "shutdowned" || $bri_user->subst == "shutdowner") {
- // QUI WAKEUP
- $table = &$room->table[$user->table];
- $bri_table = &$bri->table[0];
-
- for ($i = 0 ; $i < $bri_table->player_n ; $i++) {
- $room->user[$table->player[$i]]->subst = $bri->user[$i]->subst;
- $room->user[$table->player[$i]]->step = $bri->user[$i]->step;
- $room->user[$table->player[$i]]->trans_step = $bri->user[$i]->step+1;
- log_load($sess, "from table bri subst[".$i."]: ".$bri->user[$i]->subst);
- log_load($sess, "from table roo subst[".$i."]: ".$room->user[$table->player[$i]]->subst);
- }
-
- $room->room_join_wakeup(&$user);
-
- if (Room::save_data(&$room) == FALSE) {
- echo "ERRORE SALVATAGGIO\n";
- exit;
- }
-
- $change_page = FALSE;
- }
- log_load($sess, "from table subst: ".$bri_user->subst);
+ log_load($sess, "SET TABLE_IDX <yy".$user->table.">".TABLES_N);
+
+ log_load($sess, "SET TABLE_IDX GOOD VALUE");
+ $bri_sem = Briskin5::lock_data($user->table);
+ if (($bri = &Briskin5::load_data($user->table, $table_token)) == FALSE) {
+ // table data error: recovery
+
+ log_load($sess, "table data error: recovery".$user->table);
+
+ $table = &$room->table[$user->table];
+ for ($i = 0 ; $i < $table->player_n ; $i++) {
+ $user_cur = &$room->user[$table->player[$i]];
+ $user_cur->subst = "shutdowner";
+ $user_cur->step_inc();
+ $user_cur->trans_step = $user_cur->step;
+
+ $ret = sprintf('stat = "%s"; subst = "%s";', $cur_user->stat, $cur_user->subst);
+ $ret .= "gst.st = ".($user_cur->step+1)."; ";
+ $ret .= show_notify("<br>I dati del tavolo n°".$user->table." sono inconsistenti, verranno resettati.<br><br>Torni in piedi.<br><br>", 2000, "Chiudi.", 400, 110);
+ $user_cur->comm[$user_cur->step % COMM_N] = $ret;
+ $user_cur->step_inc();
+ }
+
+ $room->room_join_wakeup(&$user);
+
+ if (Room::save_data(&$room) == FALSE) {
+ echo "ERRORE SALVATAGGIO\n";
+ exit;
+ }
+
+ $change_page = FALSE;
+ }
+ else if (($bri_user = &$bri->get_user($sess, &$bri_idx)) != FALSE) {
+ if ($bri_user->subst == "shutdowned" || $bri_user->subst == "shutdowner") {
+ // QUI WAKEUP
+ $table = &$room->table[$user->table];
+ $bri_table = &$bri->table[0];
+
+ for ($i = 0 ; $i < $bri_table->player_n ; $i++) {
+ $room->user[$table->player[$i]]->subst = $bri->user[$i]->subst;
+ $room->user[$table->player[$i]]->step = $bri->user[$i]->step;
+ $room->user[$table->player[$i]]->trans_step = $bri->user[$i]->step+1;
+ log_load($sess, "from table bri subst[".$i."]: ".$bri->user[$i]->subst);
+ log_load($sess, "from table roo subst[".$i."]: ".$room->user[$table->player[$i]]->subst);
+ }
+
+ $room->room_join_wakeup(&$user);
+
+ if (Room::save_data(&$room) == FALSE) {
+ echo "ERRORE SALVATAGGIO\n";
+ exit;
}
- Briskin5::unlock_data($bri_sem);
+
+ $change_page = FALSE;
+ Briskin5::destroy_data(&$bri);
}
+ log_load($sess, "from table subst: ".$bri_user->subst);
}
+ Briskin5::unlock_data($bri_sem);
+
log_load($sess, "unlock Room");
if ($change_page) {
Room::unlock_data($sem);
$ret = FALSE;
$room = FALSE;
- log_rd2($sess, "M");
+ // log_rd2($sess, "M");
/* Sync check (read only without modifications */
ignore_user_abort(TRUE);
if (($sem = Room::lock_data()) != FALSE) {
}
if ($room == FALSE) {
- ignore_user_abort(TRUE);
- if (($sem = Room::lock_data()) != FALSE) {
+ do {
+ ignore_user_abort(TRUE);
+ if (($sem = Room::lock_data()) == FALSE)
+ break;
+
log_only($sess, "P");
- $room = &Room::load_data();
+ if (($room = &Room::load_data()) == FALSE)
+ break;
+ } while (0);
+
+ if ($sem != FALSE)
Room::unlock_data($sem);
- ignore_user_abort(FALSE);
- }
- else {
+
+ ignore_user_abort(FALSE);
+ if ($room == FALSE)
return (FALSE);
- }
}
if (($user = &$room->get_user($sess, $idx)) == FALSE) {
}
if ($cur_step == -1) {
- log_rd2($sess, "PRE-NEWSTAT.");
+ log_rd2($sess, "PRE-NEWSTAT: ".$user->stat);
if ($user->stat == 'room') {
log_rd($sess, "roomma");
$new_subst = $user->subst;
$new_step = $user->step;
*/
+ log_rd2($sess, "ALL COMMENTED: ".$ret);
+
+
}
log_rd2($sess, "NEWSTAT: ".$user->stat);
$user->name = "";
$user->the_end = FALSE;
- if ($user->subst == 'sitdown')
+ if ($user->subst == 'sitdown') {
+ log_load($user->sess, "ROOM WAKEUP");
$room->room_wakeup(&$user);
+ }
else if ($user->subst == 'standup')
$room->room_outstandup(&$user);
else
*/
$is_page_streaming = ((stristr($HTTP_USER_AGENT, "linux") &&
- stristr($HTTP_USER_AGENT, "firefox")) ? FALSE : TRUE);
+ (stristr($HTTP_USER_AGENT, "firefox") || stristr($HTTP_USER_AGENT, "iceweasel"))) ? FALSE : TRUE);
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
$curtime = time();
// Create new spawned table
$bri_sem = Briskin5::lock_data($table_idx);
- if (($bri =& new Briskin5(&$room, $table_idx)) == FALSE)
+ $table_token = uniqid("");
+ if (($bri =& new Briskin5(&$room, $table_idx, $table_token)) == FALSE)
log_wr($sess, "bri create: FALSE");
else
log_wr($sess, "bri create: ".serialize($bri));
for ($i = 0 ; $i < $table->player_n ; $i++) {
$bri_user_cur = &$bri->user[$i];
$user_cur = &$room->user[$table->player[$i]];
-
+
$bri_user_cur->trans_step = $user_cur->step + 1;
$bri_user_cur->comm[$bri_user_cur->step % COMM_N] = "";
$bri_user_cur->step_inc();
log_wr($sess, "Pre if!");
$ret = "";
- $ret .= sprintf('gst.st_loc++; gst.st=%d; createCookie("table_idx", %d, 24*365, cookiepath); the_end=true; window.onunload = null ; document.location.assign("briskin5/briskin5.php");|', $user_cur->step+1, $table_idx);
+ $ret .= sprintf('gst.st_loc++; gst.st=%d; createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); the_end=true; window.onunload = null ; document.location.assign("briskin5/briskin5.php");|', $user_cur->step+1, $table_idx, $table_token);
$user_cur->comm[$user_cur->step % COMM_N] = $ret;
$user_cur->trans_step = $user_cur->step + 1;