big img for supporters and sponsors added
[brisk.git] / web / index.php
index d7d1755..439e65c 100644 (file)
  */
 
 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 = "";
@@ -41,22 +42,42 @@ function main()
   if (isset($BRISK_SHOWHTML) == FALSE) {
     $is_table = FALSE;
     $sem = Room::lock_data();
+    log_main("lock Room");
     $room = &Room::load_data();
-    
+    $curtime = time();
+
     /* Actions */
+
     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") {
-         header ("Location: table.php");
+         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)) {
+      
+      log_main("pre garbage_manager DUE");
       $room->garbage_manager(TRUE);
       /* try login */
       if (($user = &$room->add_user(&$sess, &$idx, $name, $_SERVER['REMOTE_ADDR'])) != FALSE) {
@@ -132,20 +153,29 @@ function main()
     // $tables .= '</td></tr></table>';
   }
 
-  $altout_propag = array( array ( 'url' => 'http://www.alternativeoutput.it',
-                                 'content' => '<img class="nobo" src="img/altout80x15.png">' ),
-                         array ( 'url' => 'http://virtualsky.alternativeoutput.it',
-                                 'content' => '<img class="nobo" src="img/virtualsky80x15a.gif">' )
+  $altout_propag = array( array ( 'id' => 'btn_altout',
+                                  'url' => 'http://www.alternativeoutput.it',
+                                 'content' => 'img/altout80x15.png',
+                                  'content_big' => 'img/altout80x15.png'),
+                         array ( 'id' => 'btn_virtualsky',
+                                  'url' => 'http://virtualsky.alternativeoutput.it',
+                                 'content' => 'img/virtualsky80x15a.gif',
+                                  'content_big' => 'img/virtualsky_big.png')
                          );
   
   // seed with microseconds since last "whole" second
   srand ((double) microtime() * 1000000);
   // $randval = rand(0,count($altout_propag)-1);
   $randval = 1;
-  $altout_carousel = sprintf('<a target="_blank" href="%s">%s</a>',
+  $altout_carousel = sprintf('<a target="_blank" href="%s"><img id="%s" class="nobo" src="%s" onMouseOver="show_bigpict(this, \'over\');" onMouseOut="show_bigpict(this, \'out\');"></a>',
                             $altout_propag[$randval]['url'],
+                            $altout_propag[$randval]['id'],
                             $altout_propag[$randval]['content']);
                         
+  $altout_carousel_big = sprintf('<img class="nobohide" id="%s_big" src="%s">',
+                                 $altout_propag[$randval]['id'],
+                                 $altout_propag[$randval]['content_big']);
+                        
 
   $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt");
   if ($brisk_donate == FALSE)
@@ -238,14 +268,16 @@ $brisk_vertical_menu = '
 </div>
 <br><br><br>
 sponsored by:<br><br>'.$altout_carousel.'<br>
-<a target="_blank" href="http://www.dynamica.it"><img class="nobo" src="img/dynamica.png"></a><br><br>
+<a target="_blank" href="http://www.dynamica.it"><img class="nobo" id="btn_dynamica" src="img/dynamica.png" onMouseOver="show_bigpict(this, \'over\');" onMouseOut="show_bigpict(this, \'out\');"></a><br><br>
 supported by:<br><br>
-<a target="_blank" href="http://www.briscolachiamata.it"><img class="nobo" src="img/brichi.png"></a><br><br>
+<a target="_blank" href="http://www.briscolachiamata.it"><img class="nobo" id="btn_brichi" src="img/brichi.png" onMouseOver="show_bigpict(this, \'over\');" onMouseOut="show_bigpict(this, \'out\');"></a><br><br>
 <div id="proflashext" class="proflashext"><div id="proflash" class="proflash">
 </div><br><br></div>
 %s
 %s
-</div>';
+<img class="nobohide" id="btn_dynamica_big" src="img/dynamica_big.png">
+<img class="nobohide" id="btn_brichi_big" src="img/brichi_big.png">
+'.$altout_carousel_big.'</div>';
     
   /* Templates. */
   if ($ACTION == 'login') {
@@ -262,9 +294,8 @@ supported by:<br><br>
 <script type="text/javascript" src="AC_OETags.js"></script>
 <link rel="stylesheet" type="text/css" href="brisk.css">
 <link rel="stylesheet" type="text/css" href="room.css">
-</head>
-<body>
-<SCRIPT type="text/javascript">
+
+<SCRIPT type="text/javascript"><!--
    var g_withflash = false;
    var g_is_spawn = 0; 
    window.onload = function() {
@@ -276,7 +307,10 @@ supported by:<br><br>
        $("proflashext").innerHTML = "";
      $("nameid").focus();
    }
+   //-->
 </SCRIPT>
+</head>
+<body>
 <?php
     printf($brisk_header_form);
     printf("<table class=\"floaty\"><tr><td class=\"floatyleft\">\n");
@@ -325,9 +359,7 @@ Digita il tuo nickname per accedere ai tavoli della briscola.<br><br>
 <script type="text/javascript" src="AC_OETags.js"></script>
 <link rel="stylesheet" type="text/css" href="brisk.css">
 <link rel="stylesheet" type="text/css" href="room.css">
-</head>
-<body>
-<SCRIPT type="text/javascript">
+<SCRIPT type="text/javascript"><!--
    var sess;
    var stat = "";
    var subst = "";
@@ -366,8 +398,10 @@ else {
 }
 ?>
    }
-
+   //-->
 </SCRIPT>
+</head>
+<body>
 <?php
    printf($brisk_header_form);
    printf("<table class=\"floaty\"><tr><td class=\"floatyleft\">\n");