X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex_wr.php;h=c006b2539904477d68e3d197088689a90b940189;hb=76c741c96af4d4afa5096acd60bf2069c638fd7b;hp=83656ffc5954069b60a87accea460e9d4b6ca19a;hpb=f406d58f75cd486eaab74be94faf70d516684e5a;p=brisk.git diff --git a/web/index_wr.php b/web/index_wr.php index 83656ff..c006b25 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -36,7 +36,7 @@ log_wr($sess, 'COMM: '.$mesg); $sem = lock_data(); $bri = &load_data(); -if (($user = &get_user($bri, $sess, &$idx)) == FALSE) { +if (($user = &$bri->get_user($sess, &$idx)) == FALSE) { echo "Get User Error"; log_wr($sess, "Get User Error"); unlock_data($sem); @@ -44,7 +44,22 @@ if (($user = &get_user($bri, $sess, &$idx)) == FALSE) { } $argz = explode('|', $mesg); -if ($user->stat == 'room') { +if ($argz[0] == 'shutdown') { + log_auth($user_cur->sess, "Shutdown session."); + + $user->sess = ""; + $user->name = ""; + $user->the_end = FALSE; + + log_rd2($user->sess, "AUTO LOGOUT."); + if ($user->subst == 'sitdown' || $user->stat == 'table') + $bri->room_wakeup(&$user); + else if ($user->subst == 'standup') + $bri->room_outstandup(&$user); + else + log_rd2($sess, "SHUTDOWN FROM WHAT ???"); +} +else if ($user->stat == 'room') { if ($argz[0] == 'logout') { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; $user->comm[$user->step % COMM_N] .= sprintf('postact_logout();'); @@ -74,9 +89,7 @@ if ($user->stat == 'room') { // set new status $user->subst = "sitdown"; $user->table = $table_idx; - $user->table_pos = $table->player_n; - $table->player[$table->player_n] = $idx; - $table->player_n++; + $user->table_pos = $table->user_add($idx); if ($table->player_n == PLAYERS_N) { // Start game for this table. @@ -90,7 +103,7 @@ if ($user->stat == 'room') { log_wr($sess, "Pre if!"); $ret = ""; - $ret .= sprintf('gst.st_loc++; gst.st=%d; the_end=true; document.location.assign("table.php");|', $user_cur->step+1); + $ret .= sprintf('gst.st_loc++; gst.st=%d; the_end=true; window.onunload = null ; document.location.assign("table.php");|', $user_cur->step+1); $user_cur->comm[$user_cur->step % COMM_N] = $ret; $user_cur->trans_step = $user_cur->step + 1;