5 * Copyright (C) 2006 matteo.nastasi@milug.org
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details. You should have received a
16 * copy of the GNU General Public License along with this program; if
17 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
18 * Suite 330, Boston, MA 02111-1307, USA.
24 require_once("brisk.phh");
25 if (DEBUGGING == "local" && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
26 echo "Debugging time!";
30 log_load($sess, "LOAD: index.php");
34 GLOBAL $sess, $name, $BRISK_DEBUG;
39 if (isset($BRISK_DEBUG) == FALSE) {
45 if (validate_sess($sess)) {
46 $bri->garbage_manager(TRUE);
47 if (($user = &$bri->get_user($sess, &$idx)) != FALSE) {
48 if ($user->stat == "table") {
49 header ("Location: table.php");
57 if ($ACTION == "login" && isset($name)) {
58 $bri->garbage_manager(TRUE);
60 $name = substr($name, 0, 12);
61 $name = str_replace(" ", "_", $name);
62 if (($user = &$bri->add_user(&$sess, &$idx, $name)) != FALSE) {
65 // setcookie ("sess", "", time() + 180);
66 $bri->standup_update(&$user);
68 if (save_data(&$bri) == FALSE) {
69 echo "ERRORE SALVATAGGIO\n";
76 $body .= '<div class="urgmsg"><b>Spiacenti, non ci sono più posti liberi. Riprova più tardi.</b></div>';
78 $body .= '<div class="urgmsg"><b>Il tuo nickname è già in uso.</b></div>';
85 if ($BRISK_DEBUG == "debugtable") {
88 else if ($BRISK_DEBUG == "debuglogin") {
92 if ($ACTION == "room") {
93 $tables .= '<table class="room_tab" align="center">';
94 for ($i = 0 ; $i < TABLES_N ; $i++) {
97 $tables .= '<td valign="top" align="center" class="room_td"><div class="room_div"><b>Tavolo '.$i.'</b><br><br>';
98 $tables .= sprintf('<div class="proxhr" id="table%d"></div>', $i);
99 $tables .= sprintf('<div class="table_act" id="table_act%d"></div>', $i);
100 $tables .= '</div></td>'."\n";
104 $tables .= '<tr><td colspan="4">';
105 $tables .= '<div class="room_ex_standup">';
106 $tables .= '<b>Giocatori in piedi</b><br><br>';
108 $tables .= sprintf('<div id="standup" class="room_standup"></div>');
109 $tables .= '<div id="esco" class="esco"></div>';
110 $tables .= '</td></tr>';
112 $tables .= '</table>';
115 $altout_propag = array( array ( 'url' => 'http://www.alternativeoutput.it',
116 'content' => '<img class="nobo" src="img/altout80x15.png">' ),
117 array ( 'url' => 'http://virtualsky.alternativeoutput.it',
118 'content' => '<img class="nobo" src="img/virtualsky80x15.png">' )
121 // seed with microseconds since last "whole" second
122 srand ((double) microtime() * 1000000);
123 $randval = rand(0,count($altout_propag)-1);
124 $altout_carousel = sprintf('<a target="_blank" href="%s">%s</a>',
125 $altout_propag[$randval]['url'],
126 $altout_propag[$randval]['content']);
129 $brisk_header_form = '<div class="container">
130 <!-- =========== header =========== -->
131 <div id="header" class="header">
132 <img class="nobo" src="img/brisk_logo64.png">
133 briscola chiamata in salsa ajax<br><br>
136 <!-- =========== vertical menu =========== -->
137 <div class="topmenu">
138 <a target="_blank" href="/briskhome.php"><img class="nobo" src="img/brisk_homebutt.png"></a>
140 sponsored by:<br><br>'.$altout_carousel.'<br>
141 <a target="_blank" href="http://www.dynamica.it"><img class="nobo" src="img/dynamica.png"></a><br><br>
142 supported by:<br><br>
143 <a target="_blank" href="http://www.briscolachiamata.it"><img class="nobo" src="img/brichi.png"></a><br><br><br>
148 if ($ACTION == 'login') {
153 <link rel="shortcut icon" href="img/brisk_ico.png">
154 <script type="text/javascript" src="dnd.js"></script>
155 <script type="text/javascript" src="dom-drag.js"></script>
156 <script type="text/javascript" src="commons.js"></script>
157 <script type="text/javascript" src="xhr.js"></script>
158 <script type="text/javascript" src="preload_img.js"></script>
159 <link rel="stylesheet" type="text/css" href="brisk.css">
160 <link rel="stylesheet" type="text/css" href="room.css">
163 <SCRIPT type="text/javascript">
164 window.onload = function() {
169 printf($brisk_header_form, '');
172 <!-- =========== tables =========== -->
173 <div id="tables" class="tables">
174 <?php echo "$body"; ?>
177 <div style="text-align: center;">
179 Digita il tuo nickname per accedere ai tavoli della briscola.<br><br>
180 <form method="post" action="">
181 <input id="nameid" name="name" type="text" size="24" maxlength="12" value="">
182 <input id="sub" value="entra" type="submit" class="button">
188 <div id="imgct"></div>
189 <div id="logz"></div>
190 <div id="sandbox"></div>
191 <div id="sandbox2"></div>
192 <div id="response"></div>
193 <div id="xhrstart"></div>
195 <div id="xhrlog"></div>
197 <div id="xhrdeltalog"></div>
202 else if ($ACTION == 'room') {
207 <link rel="shortcut icon" href="img/brisk_ico.png">
208 <script type="text/javascript" src="dnd.js"></script>
209 <script type="text/javascript" src="dom-drag.js"></script>
210 <script type="text/javascript" src="commons.js"></script>
211 <script type="text/javascript" src="xhr.js"></script>
212 <script type="text/javascript" src="preload_img.js"></script>
213 <link rel="stylesheet" type="text/css" href="brisk.css">
214 <link rel="stylesheet" type="text/css" href="room.css">
217 <SCRIPT type="text/javascript">
221 var gst = new globst();
224 var g_imgtot = g_preload_img_arr.length;
225 var myfrom = "index_php";
226 window.onload = function() {
228 if ($BRISK_DEBUG == "debugtable") {
230 room_checkspace(12,8,50);
235 // alert("INDEX START");
236 xhr_rd = createXMLHttpRequest();
237 sess = "<?php echo "$sess"; ?>";
239 window.onunload = onunload_cb;
241 setTimeout(xhr_rd_poll, 0, sess);
242 // alert("ARR LENGTH "+g_preload_img_arr.length);
243 setTimeout(preload_images, 0, g_preload_img_arr, g_imgct);
252 printf($brisk_header_form, '<input type="button" class="button" name="xhelp" value="Help." onclick="act_help();"><br><br><input type="button" class="button" name="xabout" value="About." onclick="act_about();">');
254 <!-- =========== tables =========== -->
255 <div id="tables" class="tables">
256 <input name="sess" type="hidden" value="<?php echo "$user->sess"; ?>">
257 <?php echo "$tables"; ?>
260 <!-- =========== bottom =========== -->
261 <div id="bottom" class="bottom">
263 <div id="txt" class="chatt">
265 <table><tr><td><div id="myname" class="txtt"></div></td><td><input id="txt_in" type="text" size="90" maxlength="256" onkeypress="chatt_checksend(this,event);" class="txtt"></td></tr></table>
267 <div id="heartbit"></div>
268 <div id="sandbox"></div>
269 <div id="imgct"></div>
270 <div id="logz"></div>
271 <div id="sandbox2"></div>
272 <div id="response"></div>
273 <div id="remark"></div>
274 <div id="xhrstart"></div>
275 <div id="xhrlog"></div>
276 <div id="xhrdeltalog"></div>