X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Findex.php;h=4657e048c95298a2d05910204e6f38c46dacbb77;hb=da3f2abc9f54006cbeabfec2b61038277ac51565;hp=2e06a675e4bbe16740a3aa7d97d9eb163db78e3f;hpb=f406d58f75cd486eaab74be94faf70d516684e5a;p=brisk.git diff --git a/web/index.php b/web/index.php index 2e06a67..4657e04 100644 --- a/web/index.php +++ b/web/index.php @@ -2,7 +2,10 @@ /* * brisk - index.php * - * Copyright (C) 2006 matteo.nastasi@milug.org + * Copyright (C) 2006-2008 Matteo Nastasi + * mailto: nastasi@alternativeoutput.it + * matteo.nastasi@milug.org + * web: http://www.alternativeoutput.it * * 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,124 +24,389 @@ * */ -require_once("brisk.phh"); +require_once("Obj/brisk.phh"); +require_once("Obj/auth.phh"); +require_once("Obj/proxyscan.phh"); + +// Use of proxies isn't allowed. +if (!$G_is_local && is_proxy()) + exit; + +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 $G_with_topbanner, $G_topbanner, $G_is_local; + GLOBAL $sess, $name, $pass_private, $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 */ - 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 (save_data(&$bri) == FALSE) { + if (validate_sess($sess)) { + log_main("pre garbage_manager UNO"); + $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 (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 .= ''; - - $tables .= sprintf(''); - $tables .= ' |
';
+ $standup .= ' ';
+ $standup .= ' Giocatori in piedi ';
- $tables .= ' |
'.($G_is_local ? '' :
+'
+'
+).' |
+'.($G_with_topbanner ? '
|
+
+'.($G_is_local ? '' :
+'
+'
+).' |
+
+ |
+ + |
+ + | + + |
-+