BriskServ");
define(DBG_ONL2, 0x0001);
define(DBG_ONLY, 0x0002);
define(DBG_MAIN, 0x0004);
define(DBG_READ, 0x0008);
define(DBG_REA2, 0x0010);
define(DBG_SEND, 0x0020);
define(DBG_LOCK, 0x0040);
define(DBG_WRIT, 0x0080);
define(DBG_LOAD, 0x0100);
define(DBG_AUTH, 0x0200);
define(DBG_CRIT, 0x0400);
// NOTE: BRISK DEBUG must be a numerical constant, not the result of operations on symbols
define(BRISK_DEBUG, 0xffffffbf);
define(BRISK_SINGLE_DEBUG,0);
define(BRISK_SINGLE_SESS, "");
// define(DEBUGGING, "local");
require_once("$DOCUMENT_ROOT/Etc/".BRISK_CONF);
$G_false = FALSE;
$G_lang = "it";
$G_lng = "";
// $G_lang = "en";
// $G_lng = "_en";
$G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
$G_brisk_version = "2.1.7 - trusty";
/* MLANG: ALL THE INFO STRINGS IN brisk.phh */
$root_wellarr = Array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': menu comandi, filtro opzionale sui non autenticati e "return bug" corretto.',
'Se vuoi iscriverti alla Mailing List, cliccala!' );
$G_room_help= '
Descrizione
Questa รจ un\'implementazione della briscola in cinque, così come è spiegata su
Wikipedia; in breve è la variante con l\'asta prima sulla carta e poi sui punti.
Configurazione del browser.
Occorre abilitare i cookies.
Uso del sito
Potete sedervi a un tavolo o rimanere in piedi.
Se al vostro tavolo si raggiungono i 5 giocatori inizia automaticamente la partita.
Partita
All\'inizio vengono distribuite le carte e parte l\'asta; per partecipare all\'asta, quando sarà il vostro turno, potrete scegliere se andare avanti o passare cliccando sulle icone corrispondenti. Se si arriva ai punti, scrivete nella textbox il vostro rilancio e cliccate PUNTI.
Chi vince l\'asta dovrà decidere il seme della carta scelta e inizierà la mano.
Per giocare le carte dovrete trascinarle nel quadrato al centro del vostro schermo.
Il vostro turno è sempre segnalato da una cornice verde lampeggiante intorno al quadrato al centro del vostro schermo.
Durante la partita, se vorrete ricaricare la pagina, usate l\'apposito bottone \\"reload\\" in basso a destra.
Dopo che è iniziata una partita per uscirne dovete chiedere agli altri giocatori di sbloccarla cliccando sul lucchetto. Se non si segue questa prassi, una volta usciti, non vi potrete sedere a nessun tavolo per '.floor(BAN_TIME/60).' minuti.
Comandi della chat
/nick <nuovo_nickname> - cambio di nickname
/tav <frase di invito> - invito per gli altri giocatori al tavolo dove si è seduti
/st <stato> - cambia l\'icona associata al tuo user; stato può valere: \\"normale\\", \\"fuori\\", \\"pausa\\", \\"cibo\\", \\"cane\\", \\"lavoro\\", \\"presente\\" oppure \\"sigaretta\\"
/garante - se si è autenticati permette di garantire per un utente fidato
/mesgtoadm - se si è autenticati permette di lasciare un messaggio all\'amministratore del sito
/listen <all or auth> - se si è autenticati permette leggere solo i messaggi degli altri autenticati (auth) o di tutti (all)
';
function xcape($s)
{
$from = array ( '\\', '@', '|' );
$to = array ( '\\\\', '@', '¦' );
return (str_replace($from, $to, htmlentities($s,ENT_COMPAT,"UTF-8")));
}
function xcapelt($s)
{
$from = array ( '\\', '|', "\t", "\n");
$to = array ( '\\\\', '\\|', "\\t", "\\n");
return (str_replace($from, $to, $s));
}
function xcapemesg($s)
{
$from = array ( "\n");
$to = array ( "\\n");
return (str_replace($from, $to, $s));
}
class Table {
var $idx;
var $player;
var $player_n;
var $auth_only; // se tavolo riservato o libero
var $wag_own;
var $wag_com;
var $wag_tout;
var $table_token;
var $table_start; // information field
var $wakeup_time;
function Table()
{
}
function &create($idx)
{
GLOBAL $G_false;
if (($thiz =& new Table()) == FALSE)
return ($G_false);
$thiz->idx = $idx;
$thiz->player = array();
$thiz->player_n = 0;
$thiz->auth_only = FALSE;
$thiz->wag_own = NULL;
$thiz->wag_com = "";
$thiz->wag_tout = 0;
$thiz->table_token = "";
$thiz->table_start = 0;
$thiz->wakeup_time = 0;
return ($thiz);
}
function copy(&$from)
{
GLOBAL $G_false;
$this->idx = $from->idx;
$this->player = array();
for ($i = 0 ; $i < $from->player_n ; $i++)
$this->player[$i] = $from->player[$i];
$this->player_n = $from->player_n;
log_main("PLAYER_N - parent::copy.".$this->player_n);
$this->auth_only = $from->auth_only;
$this->wag_own = $from->wag_own;
$this->wag_com = $from->wag_com;
$this->wag_tout = $from->wag_tout;
$this->table_token = $from->table_token;
$this->table_start = $from->table_start;
$this->wakeup_time = $from->wakeup_time;
}
function &clone(&$from)
{
GLOBAL $G_false;
if (($thiz =& new Table()) == FALSE)
return ($G_false);
$this->copy($from);
return ($thiz);
}
function &spawn(&$from)
{
GLOBAL $G_false;
if (($thiz =& new Table()) == FALSE)
return ($G_false);
$thiz->idx = $from->idx;
$thiz->player = array();
for ($i = 0 ; $i < $from->player_n ; $i++)
$thiz->player[$i] = $i;
$thiz->player_n = $from->player_n;
$thiz->auth_only = $from->auth_only;
$thiz->wag_own = $from->wag_own;
$thiz->wag_com = $from->wag_com;
$thiz->wag_tout = $from->wag_tout;
$thiz->table_token = $from->table_token;
$thiz->table_start = $from->table_start;
$thiz->wakeup_time = $from->wakeup_time;
return ($thiz);
}
function wag_set(&$user, $mesg)
{
log_main("WAG_SET");
$this->wag_own = &$user;
$this->wag_com = $mesg;
$this->wag_tout = 0;
}
function wag_reset($timeout)
{
log_main("WAG_RESET");
unset($this->wag_own);
$this->wag_own = NULL;
$this->wag_com = "";
$this->wag_tout = $timeout;
}
function getPlayer($idx)
{
return ($this->player[$idx]);
}
function setPlayer($idx, $player)
{
$this->player[$idx] = $player;
}
function user_add($idx)
{
$this->player[$this->player_n] = $idx;
$this->player_n++;
return ($this->player_n - 1);
}
function user_rem(&$room, &$user)
{
$tabpos = $user->table_pos;
/* verifico la consistenza dei dati */
if ($room->user[$this->player[$tabpos]] == $user) {
/* aggiorna l'array dei giocatori al tavolo. */
for ($i = $tabpos ; $i < $this->player_n-1 ; $i++) {
$this->player[$i] = $this->player[$i+1];
$user_cur = &$room->user[$this->player[$i]];
$user_cur->table_pos = $i;
}
$this->player_n--;
}
else {
log_main("INCONSISTENCY ON TABLE.");
}
}
// $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table,
// ($this->table[$i]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH));
// function act_content($isstanding, $sitted, $table, $cur_table, $allowed)
function act_content(&$user)
{
$ret = "";
$isstanding = ($user->subst == 'standup');
$sitted = $this->player_n;
$table = $this->idx;
$cur_table = $user->table;
$allowed = TRUE;
if ($isstanding) {
if ($sitted < PLAYERS_N) {
if ($this->auth_only) {
if ($user->flags & USER_FLAG_AUTH)
$act = "sitreser";
else
$act = 'reserved';
}
else {
$act = 'sit';
}
}
else {
$act = 'none';
}
}
else {
if ($table == $cur_table)
$act = 'wake';
else
$act = 'none';
}
if ($act != '')
$ret = sprintf('j_tab_act_cont(%d, \'%s\');', $table, $act);
return ($ret);
}
} // end class Table
// User flags
define(USER_FLAG_AUTH, 0x02);
define(USER_FLAG_LISTAUTH, 0x04);
// user status
define(USER_FLAG_S_NORM, 0x000); // done
define(USER_FLAG_S_PAU, 0x100); // done
define(USER_FLAG_S_OUT, 0x200); // done
define(USER_FLAG_S_DOG, 0x300); // done
define(USER_FLAG_S_EAT, 0x400); // done
define(USER_FLAG_S_WRK, 0x500); // done
define(USER_FLAG_S_SMK, 0x600); // done
define(USER_FLAG_S_EYE, 0x700); // done
define(USER_FLAG_S_ALL, 0xf00); // done
class User {
var $name; // name of the user
var $sess; // session of the user
var $ip; // ip of the user
var $lacc; // last access (for the cleanup)
var $laccwr; // last access (for the cleanup)
var $bantime; // timeout to temporary ban
var $stat; // status (outdoor, room, table, game, ...)
var $subst; // substatus for each status
var $step; // step of the current status
var $trans_step; // step to enable transition between pages (disable == -1)
var $comm; // commands array
// var $asta_card; //
// var $asta_pnt; //
// var $handpt; // Total card points at the beginning of the current hand.
// var $exitislock; // Player can exit from the table ?
// FIXME: the table_orig field must be removed after table field verify of index management (in spawned table
// it is allways ZERO
var $table_orig; // id of the current table (if in table state)
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 $flags; // Bitfield with: AUTHENTICATE: 0x02
var $the_end; // Flag to change the end of the session
var $chat_lst; // Last chat line
var $chattime; // Array of chat times
var $chat_cur; // Current chat line number
var $chat_ban; // Time for ban chat
var $chat_dlt; // Delta t for ban
function User() {
}
function &create($name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") {
GLOBAL $G_false;
if (($thiz =& new User()) == FALSE)
return ($G_false);
$thiz->name = $name;
$thiz->sess = $sess;
$thiz->ip = $ip;
$thiz->lacc = time();
$thiz->laccwr = time();
$thiz->bantime = 0;
$thiz->stat = $stat;
$thiz->subst = $subst;
$thiz->step = 1;
$thiz->trans_step = -1;
$thiz->comm = array();
$thiz->asta_card = -2;
$thiz->asta_pnt = -1;
$thiz->handpt = -1;
$thiz->exitislock = TRUE;
$thiz->flags = 0x00;
$thiz->chattime = array_fill(0, CHAT_N, 0);
$thiz->chat_cur = 0;
$thiz->chat_lst = "";
$thiz->chat_ban = 0;
$thiz->chat_dlt = 0;
$thiz->table_orig = $table;
$thiz->table = $table;
$thiz->table_pos = -1;
$thiz->table_token = "";
return ($thiz);
}
function copy(&$from)
{
GLOBAL $G_false;
$this->name = $from->name;
$this->sess = $from->sess;
$this->ip = $from->ip;
$this->lacc = $from->lacc;
$this->laccwr = $from->laccwr;
$this->bantime = $from->bantime;
$this->stat = $from->stat;
$this->subst = $from->subst;
$this->step = $from->step;
$this->trans_step = $from->trans_step;
$this->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;
$this->comm[$ii] = $from->comm[$ii];
}
$this->asta_card = $from->asta_card;
$this->asta_pnt = $from->asta_pnt;
$this->handpt = $from->handpt;
$this->exitislock = $from->exitislock;
$this->flags = $from->flags;
$this->chattime = array();
for ($i = 0 ; $i < CHAT_N ; $i++)
$this->chattime[$i] = $from->chattime[$i];
$this->chat_cur = $from->chat_cur;
$this->chat_lst = $from->chat_lst;
$this->chat_ban = $from->chat_ban;
$this->chat_dlt = $from->chat_dlt;
$this->table_orig = $from->table_orig;
$this->table = $from->table;
$this->table_pos = $from->table_pos;
$this->table_token = $from->table_token;
$this->the_end = $from->the_end;
return (TRUE);
}
function &clone(&$from)
{
GLOBAL $G_false;
if (($thiz =& new User()) == FALSE)
return ($G_false);
$thiz->copy($from);
return ($thiz);
}
function &spawn(&$from, $table, $table_pos)
{
GLOBAL $G_false;
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->trans_step = $from->trans_step;
$thiz->comm = array();
/*
$i_start = (1 > ($from->step - COMM_N) ? 1 : ($from->step - COMM_N));
for ($i = $i_start ; $i < $from->step ; $i++) {
log_wr("TRY PUSH:".$i);
$ii = $i % COMM_N;
$thiz->comm[$ii] = $from->comm[$ii];
}
*/
$thiz->asta_card = $from->asta_card;
$thiz->asta_pnt = $from->asta_pnt;
$thiz->handpt = $from->handpt;
$thiz->exitislock = $from->exitislock;
$thiz->the_end = $from->the_end;
$thiz->flags = $from->flags;
$thiz->chattime = array_fill(0, CHAT_N, 0);
$thiz->chat_cur = 0;
$thiz->chat_lst = "";
$thiz->chat_ban = 0;
$thiz->chat_dlt = 0;
$thiz->table_orig = $table;
$thiz->table = 0;
$thiz->table_pos = $table_pos;
$thiz->table_token = $from->table_token;
return ($thiz);
}
function stat_set($stat) {
log_main("sess: [".$this->sess. "] NEW STAT: [".$stat."]");
$this->stat = "$stat";
/*
if (validate_sess($this->sess)) {
if (file_exists(PROXY_PATH) == FALSE)
mkdir(PROXY_PATH);
$fp = fopen(PROXY_PATH."/".$this->sess.".stat", 'w');
fwrite($fp, sprintf("%s\n",$this->stat));
fclose($fp);
}
*/
}
function step_set($step) {
$this->step = $step;
do {
if (validate_sess($this->sess) == FALSE)
break;
if (file_exists(PROXY_PATH) == FALSE)
mkdir(PROXY_PATH);
if (($fp = @fopen(PROXY_PATH."/".$this->sess.".step", 'w')) == FALSE)
break;
fwrite($fp, pack("l",$this->step), 4);
fclose($fp);
return (TRUE);
} while (0);
return (FALSE);
}
function step_inc($delta = 1) {
$this->step += $delta;
if (validate_sess($this->sess)) {
if (file_exists(PROXY_PATH) == FALSE)
mkdir(PROXY_PATH);
$fp = fopen(PROXY_PATH."/".$this->sess.".step", 'w');
fwrite($fp, pack("l",$this->step), 4);
fclose($fp);
return (TRUE);
}
return (FALSE);
}
function reset() {
$curtime = time();
log_legal($curtime, $this, "STAT:LOGOUT", '');
$tmp_sess = $this->sess;
$this->sess = "";
step_unproxy($tmp_sess);
$this->name = ""; // OK here
while (array_pop($this->comm) != NULL);
$this->step = 0;
$this->chattime = array_fill(0, CHAT_N, 0);
$this->chat_cur = 0;
$this->chat_lst = "";
$this->chat_ban = 0;
$this->chat_dlt = 0;
$this->the_end = FALSE;
}
} // end class User
function step_get($sess) {
$fp = FALSE;
do {
if (validate_sess($sess) == FALSE)
break;
if (file_exists(PROXY_PATH) == FALSE)
mkdir(PROXY_PATH);
if (($fp = @fopen(PROXY_PATH."/".$sess.".step", 'rb')) == FALSE)
break;
if (($s = fread($fp, 4)) == FALSE)
break;
if (strlen($s) != 4)
break;
$arr = unpack('l', $s);
fclose($fp);
// log_rd2("A0: ".$arr[0]." A1: ".$arr[1]);
return ($arr[1]);
} while (0);
if ($fp != FALSE)
fclose($fp);
log_rd2("STEP_GET: return false ");
return (FALSE);
}
function step_unproxy($sess) {
log_rd2("UNPROXY: ".PROXY_PATH."/".$sess.".step");
if (file_exists(PROXY_PATH) == FALSE)
mkdir(PROXY_PATH);
@unlink(PROXY_PATH."/".$sess.".step");
}
class Room {
var $user;
var $table;
var $comm; // commands for many people
var $step; // current step of the comm array
var $garbage_timeout;
var $shm_sz;
function Room () {
$this->user = array();
$this->table = array();
for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
$this->user[$i] =& User::create("", "");
}
for ($i = 0 ; $i < TABLES_N ; $i++) {
$this->table[$i] =& Table::create($i);
/* OLD METHOD
if ($i < 12) {
$row = ( (((int)($i / 4)) % 2) == 0 );
$col = ($i % 2 == 0);
$this->table[$i]->auth_only = (($row && $col) || (!$row && !$col));
}
else {
$this->table[$i]->auth_only = FALSE;
}
*/
if ($i < 12)
$this->table[$i]->auth_only = TRUE;
else
$this->table[$i]->auth_only = FALSE;
}
$this->garbage_timeout = 0;
}
function garbage_manager($force)
{
$ismod = FALSE;
log_rd2("garbage_manager START");
/* Garbage collector degli utenti in timeout */
$curtime = time();
if ($force || $this->garbage_timeout < $curtime) {
// FIXME BRISK4: include for each kind of table
require_once("briskin5/Obj/briskin5.phh");
// Before all align times with table timeout
for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) {
$table_cur =& $this->table[$table_idx];
// if the table is complete and exists its shared mem we get the info about users lacc
if ($table_cur->player_n == PLAYERS_N) {
log_main("PLAYERS == N TABLE ".$table_idx);
if (($sem = Briskin5::lock_data($table_idx)) != FALSE) {
log_main("bin5 lock data success");
$no_recovery = FALSE;
if (($bri = &Briskin5::load_data($table_idx)) != FALSE) {
if ($table_cur->table_token != $bri->table_token) {
log_main("ERROR: not matching table_token. Room: ".$table_cur->table_token." Table: ".$bri->table_token);
log_main("ERROR: not matching table_start. Room: ".$table_cur->table_start." Table: ".$bri->table_start);
$no_recovery = TRUE;
$bri = FALSE;
}
}
if ($bri != FALSE) {
//
// SPAWN: JOIN
//
log_main("garbage_manager: bri loaded successfully.");
$bri->garbage_manager(TRUE);
$bri_table = &$bri->table[0];
// is the end of the table
if ($bri->the_end == TRUE) {
/*
* DESTROY OF FINISHED TABLE && MOVE PLAYER TO ROOM AGAIN
*/
log_main("garbage_manager: INSIDE THE END.");
$plist = "$table_cur->table_token|$table_cur->idx|$table_cur->player_n";
for ($i = 0 ; $i < $table_cur->player_n ; $i++) {
$plist .= '|'.$this->user[$table_cur->player[$i]]->sess;
}
for ($i = 0 ; $i < $bri_table->player_n ; $i++) {
// stat must be "table" by definition
$user_cur =& $this->user[$table_cur->player[$i]];
$bri_user =& $bri->user[$i];
$user_cur->subst = $bri_user->subst;
$user_cur->step = $bri_user->step;
$user_cur->lacc = $bri_user->lacc;
$user_cur->laccwr = $bri_user->lacc;
$user_cur->bantime = $bri_user->bantime;
}
log_legal($curtime, $user_cur, "STAT:DESTROY_GAME", $plist);
$this->room_join_wakeup(&$user_cur, FALSE, 0);
$table_cur->table_token = "";
$table_cur->wakeup_time = $curtime + WAKEUP_TIME;
Briskin5::destroy_data($table_idx);
}
else {
log_main("gm:: save_data");
for ($i = 0 ; $i < $bri_table->player_n ; $i++) {
$this->user[$table_cur->player[$i]]->lacc = $bri->user[$i]->lacc;
}
Briskin5::save_data(&$bri);
}
} // else if (($bri = &Briskin5::load_data($table_idx)) != FALSE) {
else if ($no_recovery == FALSE) {
log_crit("ERROR: table ".$table_idx." unrecoverable join");
for ($i = 0 ; $i < $table_cur->player_n ; $i++) {
$user_cur = &$this->user[$table_cur->player[$i]];
$user_cur->subst = "shutdowner";
$user_cur->step_inc();
$ret = sprintf('stat = "%s"; subst = "%s";', $user_cur->stat, $user_cur->subst);
$ret .= "gst.st = ".($user_cur->step+1)."; ";
$ret .= show_notify(" I dati del tavolo n° ".$user_cur->table." sono inconsistenti, verranno resettati.
Torni in piedi.
", 2000, "Chiudi.", 400, 110);
$user_cur->comm[$user_cur->step % COMM_N] = $ret;
$user_cur->step_inc();
}
$plist = "$table_cur->table_token|$user_cur->table|$table_cur->player_n";
for ($i = 0 ; $i < $table_cur->player_n ; $i++) {
$plist .= '|'.$this->user[$table_cur->player[$i]]->sess;
}
log_legal($curtime, $user_cur, "STAT:DESTROY_GAME(RECOVERY)", $plist);
$this->room_join_wakeup(&$user_cur, TRUE, -2);
$table_cur->table_token = "";
}
Briskin5::unlock_data($sem);
} // bri::lock_data
} // if ($table_cur->player_n == PLAYERS_N) {
} // for ($table_idx = 0 ; $table_idx < TABLES_N ; $table_idx++) {
log_rd2("out new loop.");
for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
$user_cur = &$this->user[$i];
log_rd2("User: ".$user_cur->name." stat: ".$user_cur->stat." subst: ".$user_cur->subst);
if ($user_cur->sess == "")
continue;
if ($user_cur->lacc + EXPIRE_TIME_RD < $curtime) {
// Auto logout dell'utente
log_rd2("AUTO LOGOUT.".($user_cur->lacc + EXPIRE_TIME_RD)." curtime ".$curtime);
if ($user_cur->stat == 'table' || $user_cur->stat == 'room') {
log_auth($user_cur->sess, "Autologout session.");
$user_cur->reset();
log_rd2("AUTO LOGOUT.");
if ($user_cur->subst == 'sitdown' || $user_cur->stat == 'table')
$this->room_wakeup(&$user_cur);
else if ($user_cur->subst == 'standup')
$this->room_outstandup(&$user_cur);
else
log_rd2("LOGOUT FROM WHAT ???");
}
}
if ($user_cur->laccwr + EXPIRE_TIME_SMAMMA < $curtime) { // lo rimettiamo in piedi
if ($user_cur->stat == 'room' && $user_cur->subst == 'sitdown') {
$this->room_wakeup(&$user_cur);
$user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; ";
/* MLANG: Sei stato inattivo per ".(EXPIRE_TIME_SMAMMA/60.0)." minuti.
Quindi ritorni tra i Giocatori in piedi.", "torna ai tavoli" */
$user_cur->comm[$user_cur->step % COMM_N] .= show_notify(" Sei stato inattivo per ".(EXPIRE_TIME_SMAMMA/60.0)." minuti.
", " Il messaggio di segnalazione del tavolo è già attivato.
", " Il messaggio di segnalazione del tavolo è disattivato ancora per %d second%s.
" */
$msg = " Per attivare il messaggio di segnalazione del tavolo occorre essere seduti.
";
$to_user = show_notify($msg, 0, "chiudi", 400, 100);
break;
}
$table = &$this->table[$user->table];
if ($table->wag_own != NULL) {
$msg = " Il messaggio di segnalazione del tavolo è già attivato.
";
$to_user = show_notify($msg, 0, "chiudi", 400, 100);
break;
}
$dtime = $curtime - $table->wag_tout;
if ($dtime < EXPIRE_TIME_WAG) {
$msg = sprintf(" Il messaggio di segnalazione del tavolo è disattivato ancora per %d second%s.