flash detection js
[brisk.git] / web / index.php
index 918d0b5..171f2aa 100644 (file)
@@ -57,8 +57,6 @@ function main()
     if ($ACTION == "login" && isset($name)) {
       $bri->garbage_manager(TRUE);
       /* try login */
-      $name = substr($name, 0, 12);
-      $name = str_replace(" ", "_", $name);
       if (($user = &$bri->add_user(&$sess, &$idx, $name)) != FALSE) {
        $ACTION = "room";
        
@@ -72,7 +70,9 @@ function main()
       }
       else {
        /* Login Rendering */
-       if ($idx == -1) 
+       if ($idx == -2)
+         $body .= '<div class="urgmsg"><b>Il nickname deve contenere almeno una lettera o una cifra.</b></div>';
+       else if ($idx == -1) 
          $body .= '<div class="urgmsg"><b>Spiacenti, non ci sono pi&ugrave; posti liberi. Riprova pi&ugrave; tardi.</b></div>';
        else
          $body .= '<div class="urgmsg"><b>Il tuo nickname &egrave; gi&agrave; in uso.</b></div>';
@@ -112,9 +112,23 @@ function main()
     $tables .= '</table>';
   }
 
-$brisk_header = '<div class="container">
+  $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/virtualsky80x15.png">' )
+                         );
+  
+  // seed with microseconds since last "whole" second
+  srand ((double) microtime() * 1000000);
+  $randval = rand(0,count($altout_propag)-1);
+  $altout_carousel = sprintf('<a target="_blank" href="%s">%s</a>',
+                            $altout_propag[$randval]['url'],
+                            $altout_propag[$randval]['content']);
+                        
+
+$brisk_header_form = '<div class="container">
 <!-- =========== header ===========  -->
-<div class="header">
+<div id="header" class="header">
 <img class="nobo" src="img/brisk_logo64.png">
 briscola chiamata in salsa ajax<br><br>
 </div>
@@ -123,11 +137,11 @@ briscola chiamata in salsa ajax<br><br>
 <div class="topmenu">
 <a target="_blank" href="/briskhome.php"><img class="nobo" src="img/brisk_homebutt.png"></a>
 <br><br><br>
-sponsored by:<br><br>
-<a target="_blank" href="http://www.alternativeoutput.it"><img class="nobo" src="img/altout80x15.png"></a><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>
 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" src="img/brichi.png"></a><br><br><br>
+%s
 </div>';
     
   /* Templates. */
@@ -142,6 +156,7 @@ supported by:<br><br>
 <script type="text/javascript" src="commons.js"></script> 
 <script type="text/javascript" src="xhr.js"></script>
 <script type="text/javascript" src="preload_img.js"></script>
+<link rel="stylesheet" type="text/css" href="brisk.css">
 <link rel="stylesheet" type="text/css" href="room.css">
 </head>
 <body>
@@ -151,11 +166,11 @@ supported by:<br><br>
    }
 </SCRIPT>
 <?php
-    echo "$brisk_header";
+    printf($brisk_header_form, '');
 ?> 
 
 <!--  =========== tables ===========  -->
-<div class="tables">
+<div id="tables" class="tables">
 <?php echo "$body"; ?>
 
 <br>
@@ -195,6 +210,7 @@ Digita il tuo nickname per accedere ai tavoli della briscola.<br><br>
 <script type="text/javascript" src="commons.js"></script> 
 <script type="text/javascript" src="xhr.js"></script>
 <script type="text/javascript" src="preload_img.js"></script>
+<link rel="stylesheet" type="text/css" href="brisk.css">
 <link rel="stylesheet" type="text/css" href="room.css">
 </head>
 <body>
@@ -224,7 +240,7 @@ else {
 
      setTimeout(xhr_rd_poll, 0, sess); 
      // alert("ARR LENGTH "+g_preload_img_arr.length);
-     // setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
+     setTimeout(preload_images, 0, g_preload_img_arr, g_imgct); 
      $("txt_in").focus();
 <?php
 }
@@ -233,16 +249,16 @@ else {
 
 </SCRIPT>
 <?php
-    echo "$brisk_header";
+    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();">');
 ?> 
 <!--  =========== tables ===========  -->
-<div class="tables">
+<div id="tables" class="tables">
 <input name="sess" type="hidden" value="<?php echo "$user->sess"; ?>">
 <?php echo "$tables"; ?>
 </div>
 
 <!--  =========== bottom ===========  -->
-<div class="bottom">
+<div id="bottom" class="bottom">
 <b>Chat</b>
 <div id="txt" class="chatt">
 </div>