From 461b072662d5d1fb0e2e7d8cfc24cd63f726343c Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Tue, 16 Jan 2007 19:53:10 +0000 Subject: [PATCH] modificata la gestione del cookie sess --- web/commons.js | 3 ++- web/index.php | 26 ++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/web/commons.js b/web/commons.js index 18b89c8..0b1275e 100644 --- a/web/commons.js +++ b/web/commons.js @@ -244,7 +244,7 @@ function postact_logout() xhr_rd.abort(); } catch (e) {} - eraseCookie("sess"); + // eraseCookie("sess"); document.location.assign("index.php"); } @@ -457,6 +457,7 @@ function notify(st, ancestor, text, tout, butt) clo = document.createElement("input"); clo.type = "submit"; + clo.className = "button"; clo.value = butt; clo.obj = this; clo.onclick = this.input_hide; diff --git a/web/index.php b/web/index.php index 2cfa99e..100547f 100644 --- a/web/index.php +++ b/web/index.php @@ -42,28 +42,26 @@ function main() $bri = &load_data(); /* Actions */ - if (isset($sess)) { + if (validate_sess($sess)) { $bri->garbage_manager(TRUE); - if (($user = &get_user(&$bri, $sess, &$idx)) != FALSE) { + if (($user = &$bri->get_user($sess, &$idx)) != FALSE) { if ($user->stat == "table") { header ("Location: table.php"); unlock_data($sem); exit; } - $ACTION = "table"; - } - else { - setcookie ("sess", "", time() - 3600); + $ACTION = "room"; } } - else if (isset($name)) { + + if ($ACTION == "login" && isset($name)) { $bri->garbage_manager(TRUE); /* try login */ $name = substr($name, 0, 12); - if (($user = &add_user(&$bri, &$sess, &$idx, $name)) != FALSE) { - $ACTION = "table"; + if (($user = &$bri->add_user(&$sess, &$idx, $name)) != FALSE) { + $ACTION = "room"; - setcookie ("sess", "", time() + 180); + // setcookie ("sess", "", time() + 180); standup_update(&$bri,&$user); if (save_data(&$bri) == FALSE) { @@ -84,13 +82,13 @@ function main() /* Rendering. */ if ($BRISK_DEBUG == "debugtable") { - $ACTION = "table"; + $ACTION = "room"; } else if ($BRISK_DEBUG == "debuglogin") { $ACTION = "login"; } - if ($ACTION == "table") { + if ($ACTION == "room") { $tables .= ''; for ($i = 0 ; $i < TABLES_N ; $i++) { if ($i % 4 == 0) @@ -184,7 +182,7 @@ Digita il tuo nickname per accedere ai tavoli della briscola.

@@ -224,7 +222,7 @@ else { setTimeout(xhr_rd_poll, 0, sess); // alert("ARR LENGTH "+g_preload_img_arr.length); - setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); + // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); $("txt_in").focus();