X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Findex.php;h=58905903e8dd18f48fb3a5be1e98a833938703d2;hb=e13f2827ff80498bcf463d565ee9a08c1786f886;hp=afb2f943d5fa2c44e39f0daa7047dced51c9ced2;hpb=e480c5fd85ce78d5d0436b217b2ea2944997b1ef;p=brisk.git
diff --git a/web/index.php b/web/index.php
index afb2f94..5890590 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-2009 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,123 +24,606 @@
*
*/
-require_once("brisk.phh");
+require_once("Obj/brisk.phh");
+require_once("Obj/auth.phh");
+require_once("Obj/proxyscan.phh");
+
+$mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati.',
+ 'en' => 'Wrong user and/or password.') );
+
+// 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 pool_dom() {
+ GLOBAL $G_with_pool;
+
+ // $G_with_pool = TRUE;
+ $G_with_pool = FALSE;
+
+ if ($G_with_pool) {
+ return sprintf('
+
+
+
+
+
+//
+//
+//
+//
+// ');
+ }
+ else
+ return '';
+}
function main()
{
- GLOBAL $sess, $name;
-
+ GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local;
+ GLOBAL $G_with_sidebanner, $G_sidebanner;
+ GLOBAL $sess, $name, $pass_private, $table_idx, $table_token, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
+ GLOBAL $G_lang, $G_lng, $mlang_room;
+ $is_login = FALSE;
$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 .= 'Spiacenti, non ci sono più posti liberi. Riprova più tardi.
';
- else
- $body .= 'Il tuo nickname è già in uso.
';
+
+ if ($ACTION == "login" && isset($name)) {
+
+ log_main("pre garbage_manager DUE");
+
+ if (isset($pass_private) == FALSE) {
+ $pass_private = FALSE;
+ }
+
+ $room->garbage_manager(TRUE);
+ /* try login */
+ if (($user = &$room->add_user(&$sess, &$idx, $name, $pass_private, $_SERVER['REMOTE_ADDR'])) != FALSE) {
+ $ACTION = "room";
+ if ($idx < 0) {
+ $idx = -$idx - 1;
+ $is_login = TRUE;
+ }
+
+ log_legal($curtime, $user, "STAT:LOGIN", '');
+
+ // recovery lost game
+ 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;
+ }
+
+
+ // setcookie ("sess", "", time() + 180);
+ $room->standup_update(&$user);
+
+ if (Room::save_data(&$room) == FALSE) {
+ echo "ERRORE SALVATAGGIO\n";
+ exit;
+ }
+ }
+ else {
+ /* Login Rendering */
+ /* MLANG: "Utente e/o password errati.", "Il nickname deve contenere almeno una lettera o una cifra.", "Spiacenti, non ci sono più posti liberi. Riprova più tardi.", "Il tuo nickname è già in uso." */
+ if ($idx == -3)
+ $body .= ''.$mlang_room['userpasserr'][$G_lang].'
';
+ else if ($idx == -2)
+ $body .= 'Il nickname deve contenere almeno una lettera o una cifra.
';
+ else if ($idx == -1)
+ $body .= 'Spiacenti, non ci sono più posti liberi. Riprova più tardi.
';
+ else
+ $body .= 'Il tuo nickname è già in uso.
';
+ }
}
+ Room::unlock_data($sem);
}
- unlock_data($sem);
-
/* Rendering. */
- if ($ACTION == "table") {
- $tables .= '';
- for ($i = 0 ; $i < TABLES_N ; $i++) {
- if ($i % 4 == 0)
+ if ($BRISK_SHOWHTML == "debugtable") {
+ $ACTION = "room";
+ }
+ else if ($BRISK_SHOWHTML == "debuglogin") {
+ $ACTION = "login";
+ }
+
+ if ($ACTION == "room") {
+ $tables .= '';
+ $tables .= '
';
+ for ($ii = 0 ; $ii < TABLES_N ; $ii++) {
+ if ($user->flags & USER_FLAG_AUTH)
+ $i = $ii;
+ else
+ $i = TABLES_N - $ii - 1;
+
+ if ($ii % 4 == 0)
$tables .= '';
- $tables .= 'Tavolo '.$i.'
';
+ $tables .= ' | ';
+ $tables .= 'Tavolo '.$i.' ';
$tables .= sprintf(' ', $i);
- $tables .= sprintf(' ', $i);
- $tables .= ' | ';
- if ($i % 4 == 3)
+ $tables .= sprintf('', $i);
+ $tables .= '';
+ $tables .= ''."\n";
+ if ($ii % 4 == 3)
$tables .= '
';
}
- $tables .= '';
- $tables .= ' ';
- $tables .= 'Giocatori in piedi
';
+ $tables .= ' |
';
+
+
+ $standup .= '';
+ $standup .= '';
+ /* MLANG: "Giocatori in piedi", "Come ottenere user e password" */
+ // $standup .= ' ';
+ $standup .= ' Giocatori in piedi ';
- $tables .= sprintf(' ');
- $tables .= ' ';
- $tables .= ' |
';
+ $standup .= sprintf('');
+ $standup .= '';
+ $standup .= '
';
+ }
+
+ $altout_sponsor_arr = array( array ( 'id' => 'btn_altout',
+ 'url' => 'http://www.alternativeoutput.it',
+ 'content' => 'img/altout80x15.png',
+ 'content_big' => 'img/logotxt_banner.png'),
+ array ( 'id' => 'btn_virtualsky',
+ 'url' => 'http://virtualsky.alternativeoutput.it',
+ 'content' => 'img/virtualsky80x15a.gif',
+ 'content_big' => 'img/virtualsky_big.png'),
+ array ( 'id' => 'btn_dynamica',
+ 'url' => 'http://www.dynamica.it',
+ 'content' => 'img/dynamica.png',
+ 'content_big' => 'img/dynamica_big.png')
+ );
+
+ $altout_support_arr = array( array ( 'id' => 'btn_brichi',
+ 'url' => 'http://www.briscolachiamata.it',
+ 'content' => 'img/brichi.png',
+ 'content_big' => 'img/brichi_big.png'),
+ array ( 'id' => 'btn_foroli',
+ 'url' => 'http://www.forumolimpia.it',
+ 'content' => 'img/forumolimpia.gif',
+ 'content_big' => 'img/forumolimpia_big.png' ) );
+
+
+
+ $altout_support = "";
+ for ($i = 0 ; $i < 3 ; $i++) {
+ $ii = ($i < 2 ? $i : 0);
+
+ $altout_support .= sprintf('
',
+ $i * 20, $altout_support_arr[$ii]['url'],
+ $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content']);
- $tables .= '
';
+ $altout_support_big .= sprintf('',
+ $altout_support_arr[$ii]['id'], $altout_support_arr[$ii]['content_big']);
}
+
+
+ // seed with microseconds since last "whole" second
+ // srand ((double) microtime() * 1000000);
+ // $randval = rand(0,count($altout_sponsor_arr)-1);
+ $altout_sponsor = "";
+ for ($i = 0 ; $i < 4 ; $i++) {
+ $ii = ($i < 3 ? $i : 0);
+
+ $altout_sponsor .= sprintf('
',
+ $i * 20, $altout_sponsor_arr[$ii]['url'],
+ $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content']);
+
+ $altout_sponsor_big .= sprintf('',
+ $altout_sponsor_arr[$ii]['id'], $altout_sponsor_arr[$ii]['content_big']);
+ }
+
+
+
+
+
+ $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt");
+ if ($brisk_donate == FALSE)
+ $brisk_donate = "";
+
+
+ /* MLANG: "briscola chiamata in salsa ajax", */
+
+$brisk_header_form = '
+
+';
+
+/* MLANG: ALL THE VERTICAL MENU */
+$brisk_vertical_menu = '
+
+';
/* Templates. */
if ($ACTION == 'login') {
+ header('Content-type: text/html; charset="utf-8"',true);
?>
Brisk
+
+
+
+
+
+
+
-
-
-
-
-
briscola chiamata in salsa ajax
-
-
+
+
+
+
\n");
+ printf($brisk_vertical_menu, '', '');
+ if ($G_with_sidebanner) {
+ printf("
%s", $G_sidebanner);
+ }
+ printf(" | ");
+?>
+
+
+
+
Digita il tuo nickname per accedere ai tavoli della briscola.
-
+
+ Se non hai ancora una password, lascia il campo in bianco ed entra.
+(se usi firefox e qualcosa non funziona prova a ricaricare la pagina con Ctrl + F5)
-
-
+
+
@@ -152,63 +638,189 @@ Digita il tuo nickname per accedere ai tavoli della briscola.
Brisk
+
+
+
+
+
+
-
-
-
-
-briscola chiamata in salsa ajax
-
-
+
+
+
+ |
\n");
+ /* printf($brisk_vertical_menu, '
',
+ $brisk_donate);
+ printf($brisk_vertical_menu, '
',
+ $brisk_donate);*/
+ printf($brisk_vertical_menu, ' ',
+ $brisk_donate);
+
+
+ if ($G_with_sidebanner) {
+ printf("
%s", $G_sidebanner);
+ }
+ printf(" | ");
+?>
+
sess"; ?>">
+
+ |
-
Chat
-
+
+
-
-
+
+
+
Garantisci per un tuo conoscente:
+
-
+
+
+
+
+
Invia un messaggio o una segnalazione all'amministratore:
+
+
+
+
+
-
+
-
-
+