X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Findex.php;h=e0db3d22e1ba8342ed84509ed1408da3e2659999;hb=5518138d550078d7eb72c63fa9ac29d5d3cfc890;hp=5815c9777d904a545843f7ea739fbf342ed8c9f1;hpb=a08ed840c96e0d2a20548591b83c4392b6515d8b;p=brisk.git diff --git a/web/index.php b/web/index.php index 5815c97..e0db3d2 100644 --- a/web/index.php +++ b/web/index.php @@ -2,7 +2,7 @@ /* * brisk - index.php * - * Copyright (C) 2006 matteo.nastasi@milug.org + * Copyright (C) 2006-2007 matteo.nastasi@milug.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,89 +21,250 @@ * */ -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($sess, "LOAD: index.php"); +log_load("index.php"); function main() { - GLOBAL $sess, $name; + GLOBAL $sess, $name, $table_idx, $table_token, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER; $body = ""; + $tables = ""; + $standup = ""; $ACTION = "login"; - $is_table = false; - $sem = lock_data(); - $bri = &load_data(); - - /* Actions */ - if (isset($sess)) { - $bri->garbage_manager(TRUE); - if (($user = &get_user(&$bri, $sess, &$idx)) != FALSE) { - if ($user->stat == "table") { - header ("Location: table.php"); - unlock_data($sem); - exit; - } - $ACTION = "table"; - } - else { - setcookie ("sess", "", time() - 3600); - } - } - else if (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 (isset($BRISK_SHOWHTML) == FALSE) { + $is_table = FALSE; + $sem = Room::lock_data(); + log_main("lock Room"); + $room = &Room::load_data(); + $curtime = time(); - setcookie ("sess", "", time() + 180); - standup_update(&$bri,&$user); + /* Actions */ + + if (validate_sess($sess)) { + 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") { + 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 (save_data(&$bri) == FALSE) { + if (Room::save_data(&$room) == FALSE) { echo "ERRORE SALVATAGGIO\n"; exit; } } - else { - /* Login Rendering */ - if ($idx == -1) - $body .= '
Tavolo '.$i.' '; + $tables .= ' | ';
+ $tables .= ' Tavolo '.$i.' ';
$tables .= sprintf('', $i);
- $tables .= sprintf('', $i);
- $tables .= ' | ';
+ $tables .= sprintf('', $i);
+ $tables .= '';
+ $tables .= ''."\n";
if ($i % 4 == 3)
$tables .= '||
';
- $tables .= ' ';
- $tables .= 'Giocatori in piedi '; + $tables .= ' |
';
+ $standup .= ' ';
+ $standup .= ' ';
- $tables .= 'Giocatori in piedi ';
- $tables .= sprintf('');
- $tables .= ' |
';
+ $tables .= ' ';
+ $tables .= 'Giocatori in piedi';
- $tables .= ' |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+![]() + |
+
+
+
+
+
+
+
+
+
+ |
+
+ |
+ + |
+ + | + + |
-+