source IP address stored into log
[brisk.git] / web / briskin5 / index_wr.php
index d865972..4c816fd 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *  brisk - index_wr.php
  *
- *  Copyright (C) 2006-2011 Matteo Nastasi
+ *  Copyright (C) 2006-2012 Matteo Nastasi
  *                          mailto: nastasi@alternativeoutput.it 
  *                                  matteo.nastasi@milug.org
  *                          web: http://www.alternativeoutput.it
@@ -42,6 +42,7 @@ function bin5_index_wr_main(&$bri, $remote_addr, $get, $post, $cookie)
 {
     GLOBAL $G_base, $G_dbasetype;
 
+    $curtime = time();
     if ($bri == NULL) {
         return FALSE;
     }
@@ -72,8 +73,13 @@ function bin5_index_wr_main(&$bri, $remote_addr, $get, $post, $cookie)
     
     log_wr('POSTSPLIT: '.$argz[0].'  user->stat: ['.$user->stat.']');
     log_wr($user->step, 'bin::index_wr.php: after get_user()');
+
+    $user->lacc = $curtime;
     
-    if (false && $argz[0] == 'shutdown') {
+    if ($argz[0] == 'ping') {
+        log_wr("PING RECEIVED");
+    }
+    else 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.");
@@ -105,8 +111,6 @@ function bin5_index_wr_main(&$bri, $remote_addr, $get, $post, $cookie)
             $bri->chatt_send(&$user,$mesg);
         }
         else if ($argz[0] == 'preferences_update') {
-            GLOBAL $CO_bin5_pref_ring_endauct;
-            
             log_wr("PER DI PREFERENCES_UPDATE");
             
             if ($CO_bin5_pref_ring_endauct == "true")
@@ -173,7 +177,8 @@ function bin5_index_wr_main(&$bri, $remote_addr, $get, $post, $cookie)
                 $table->mult += 1; 
                 $table->old_reason = sprintf("Ha lasciato %s perché aveva al massimo 2 punti.", xcape($user->name));
                 
-                $table->game_next();
+                // Non si cambia mazzo se si abbandona la partita
+                // $table->game_next();
                 $table->game_init(&$bri->user);
                 
                 for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {    
@@ -481,7 +486,6 @@ function bin5_index_wr_main(&$bri, $remote_addr, $get, $post, $cookie)
                         $pt_cur = calculate_points(&$table);
                         
                         $plist = "$table->table_token|$user->table_orig|$table->player_n";
-                        $curtime = time();
                         $ucodes = array();
                         for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {
                             $user_cur = &$bri->user[$table->player[$i]];
@@ -491,7 +495,7 @@ function bin5_index_wr_main(&$bri, $remote_addr, $get, $post, $cookie)
                         for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {
                             $plist .= '|'.xcapelt($ucodes[$i]);
                         }
-                        log_legal($curtime, 'xxx', $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
+                        log_legal($curtime, $user->ip, $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
                         if ($user->table_orig < TABLES_AUTH_N) {
                             require_once("../Obj/dbase_".$G_dbasetype.".phh");