/*
* brisk - index_wr.php
*
- * Copyright (C) 2006-2009 Matteo Nastasi
+ * Copyright (C) 2006-2011 Matteo Nastasi
* mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
* not, write to the Free Software Foundation, Inc, 59 Temple Place -
* Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
- *
*/
+
+$G_base = "../";
+
require_once("../Obj/brisk.phh");
// require_once("../Obj/proxyscan.phh");
require_once("Obj/briskin5.phh");
if ($table_idx < 0 || $table_idx >= TABLE_N)
exit;
+log_mop(0, 'bin::index_wr.php: COMM: '.xcapemesg($mesg));
+
$sem = Briskin5::lock_data($table_idx);
if (($bri = &Briskin5::load_data($table_idx,$table_token)) == FALSE) {
$argz = explode('|', $mesg);
log_wr('POSTSPLIT: '.$argz[0]);
+log_mop($user->step, 'bin::index_wr.php: after get_user()');
-if ($argz[0] == 'shutdown') {
+if (false && $argz[0] == 'shutdown') {
log_auth($user_cur->sess, "Shutdown session. delegate to room gc the autologout");
log_rd2("bin5/index_wr.php: AUTO LOGOUT.");
$plist = "$table->table_token|$user->table_orig|$table->player_n";
$curtime = time();
+ $ucodes = array();
for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) {
$user_cur = &$bri->user[$table->player[$i]];
$plist .= '|'.xcapelt($user_cur->name).'|'.$pt_cur[$i];
+ $ucodes[$i] = $user_cur->code_get();
+ }
+ for ($i = 0 ; $i < BRISKIN5_PLAYERS_N ; $i++) {
+ $plist .= '|'.xcapelt($ucodes[$i]);
}
log_legal($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
- if ($user->table_orig < TABLES_AUTH_N)
- log_points($curtime, xcapelt($user), "STAT:BRISKIN5:FINISH_GAME", $plist);
+ if ($user->table_orig < TABLES_AUTH_N) {
+ require_once("../Obj/dbase_".$G_dbasetype.".phh");
+
+ if (($bdb = BriskDB::create()) != FALSE) {
+ $bdb->bin5_points_save($curtime, $table->table_token, $user->table_orig, $ucodes, $pt_cur);
+ unset($bdb);
+ }
+ else {
+ log_points($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", "DATABASE CONNECTION FAILED");
+ }
+ log_points($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
+ }
$table->game_next();
$table->game_init(&$bri->user);
}
log_wr("before save data");
Briskin5::save_data($bri);
+log_mop($user->step, 'bin::index_wr.php: after save_data()');
Briskin5::unlock_data($sem);
exit;