X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex.php;h=e0db3d22e1ba8342ed84509ed1408da3e2659999;hb=c2fcedbadc3295bb207b9948174408eea2877f22;hp=e561d687d1719fb5cd2720e7a0b55e06cb2c401b;hpb=5bf5e2af26e645234720bd7a87c561ce7359cafa;p=brisk.git diff --git a/web/index.php b/web/index.php index e561d68..e0db3d2 100644 --- a/web/index.php +++ b/web/index.php @@ -21,17 +21,18 @@ * */ -require_once("brisk.phh"); +require_once("Obj/brisk.phh"); +require_once("briskin5/Obj/briskin5.phh"); if (DEBUGGING == "local" && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') { echo "Debugging time!"; exit; } -log_load((isset($sess) ? $sess : "XXX"), "LOAD: index.php"); +log_load("index.php"); function main() { - GLOBAL $sess, $name, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER; + GLOBAL $sess, $name, $table_idx, $table_token, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER; $body = ""; $tables = ""; @@ -40,32 +41,50 @@ function main() if (isset($BRISK_SHOWHTML) == FALSE) { $is_table = FALSE; - $sem = lock_data(); - $bri = &load_data(); - + $sem = Room::lock_data(); + log_main("lock Room"); + $room = &Room::load_data(); + $curtime = time(); + /* Actions */ + if (validate_sess($sess)) { - $bri->garbage_manager(TRUE); - if (($user = &$bri->get_user($sess, &$idx)) != FALSE) { + log_main("pre garbage_manager"); + $room->garbage_manager(TRUE); + log_main("post garbage_manager"); + if (($user = &$room->get_user($sess, &$idx)) != FALSE) { + log_main("user stat: ".$user->stat); if ($user->stat == "table") { - header ("Location: table.php"); - unlock_data($sem); + if (Room::save_data(&$room) == FALSE) { + echo "ERRORE SALVATAGGIO\n"; + exit; + } + log_main("unlock Room"); + Room::unlock_data($sem); + setcookie("table_token", $user->table_token, $curtime + 31536000); + setcookie("table_idx", $user->table, $curtime + 31536000); + header ("Location: briskin5/index.php"); exit; } $ACTION = "room"; } + + if (Room::save_data(&$room) == FALSE) { + echo "ERRORE SALVATAGGIO\n"; + exit; + } } if ($ACTION == "login" && isset($name)) { - $bri->garbage_manager(TRUE); + $room->garbage_manager(TRUE); /* try login */ - if (($user = &$bri->add_user(&$sess, &$idx, $name, $_SERVER['REMOTE_ADDR'])) != FALSE) { + if (($user = &$room->add_user(&$sess, &$idx, $name, $_SERVER['REMOTE_ADDR'])) != FALSE) { $ACTION = "room"; // setcookie ("sess", "", time() + 180); - $bri->standup_update(&$user); + $room->standup_update(&$user); - if (save_data(&$bri) == FALSE) { + if (Room::save_data(&$room) == FALSE) { echo "ERRORE SALVATAGGIO\n"; exit; } @@ -80,7 +99,7 @@ function main() $body .= '
Il tuo nickname è già in uso.
'; } } - unlock_data($sem); + Room::unlock_data($sem); } /* Rendering. */ @@ -266,7 +285,7 @@ supported by: