minor corrections
[brisk.git] / web / index.php
index 090f960..6298b02 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *  brisk - index.php
  *
- *  Copyright (C) 2006 matteo.nastasi@milug.org
+ *  Copyright (C) 2006-2007 matteo.nastasi@milug.org
  *
  * 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
@@ -27,17 +27,18 @@ if (DEBUGGING == "local" && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
   exit;
 }
 
-log_load($sess, "LOAD: index.php");
+log_load((isset($sess) ? $sess : "XXX"), "LOAD: index.php");
 
 function main()
 {
-  GLOBAL $sess, $name, $BRISK_DEBUG;
+  GLOBAL $sess, $name, $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER;
   
   $body = "";
+  $tables = "";
   $ACTION = "login";
   
-  if (isset($BRISK_DEBUG) == FALSE) {
-    $is_table = false;
+  if (isset($BRISK_SHOWHTML) == FALSE) {
+    $is_table = FALSE;
     $sem = lock_data();
     $bri = &load_data();
     
@@ -57,7 +58,7 @@ function main()
     if ($ACTION == "login" && isset($name)) {
       $bri->garbage_manager(TRUE);
       /* try login */
-      if (($user = &$bri->add_user(&$sess, &$idx, $name)) != FALSE) {
+      if (($user = &$bri->add_user(&$sess, &$idx, $name, $_SERVER['REMOTE_ADDR'])) != FALSE) {
        $ACTION = "room";
        
        // setcookie ("sess", "", time() + 180);      
@@ -82,10 +83,10 @@ function main()
   }
   /* Rendering. */
 
-  if ($BRISK_DEBUG == "debugtable") {
+  if ($BRISK_SHOWHTML == "debugtable") {
     $ACTION = "room";
   }
-  else if ($BRISK_DEBUG == "debuglogin") {
+  else if ($BRISK_SHOWHTML == "debuglogin") {
     $ACTION = "login";
   }
 
@@ -126,13 +127,70 @@ function main()
                             $altout_propag[$randval]['content']);
                         
 
+  $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt");
+  if ($brisk_donate == FALSE)
+    $brisk_donate = "";
+
 $brisk_header_form = '<div class="container">
 <!-- =========== header ===========  -->
 <div id="header" class="header">
-<img class="nobo" src="img/brisk_logo64.png">
-briscola chiamata in salsa ajax<br><br>
-</div>
+<table width="100%%" border="0" cols="3"><tr>
+<td align="left"><div style="padding-left: 8px;">
+
+
+
+<script type="text/javascript"><!--
+google_ad_client = "pub-5246925322544303";
+google_ad_width = 234;
+google_ad_height = 60;
+google_ad_format = "234x60_as";
+google_ad_type = "text_image";
+google_ad_channel = "";
+google_color_border = "808080";
+google_color_bg = "f6f6f6";
+google_color_link = "ffae00";
+google_color_text = "404040";
+google_color_url = "000000";
+//-->
+</script>
+<script type="text/javascript"
+  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+
+
+
+</div></td>
+<td align="center"><div>
+    <img class="nobo" src="img/brisk_logo64.png">
+    briscola chiamata in salsa ajax<br><br>
+    </div></td>
+<td align="right"><div style="padding-right: 8px;">
 
+
+
+<script type="text/javascript"><!--
+google_ad_client = "pub-5246925322544303";
+google_ad_width = 234;
+google_ad_height = 60;
+google_ad_format = "234x60_as";
+google_ad_type = "text_image";
+google_ad_channel = "";
+google_color_border = "808080";
+google_color_bg = "f6f6f6";
+google_color_link = "ffae00";
+google_color_text = "404040";
+google_color_url = "000000";
+//-->
+</script>
+<script type="text/javascript"
+  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+
+
+
+</div></td>
+</td></table>
+</div>
 <!--  =========== vertical menu ===========  -->
 <div class="topmenu">
 <a target="_blank" href="/briskhome.php"><img class="nobo" src="img/brisk_homebutt.png"></a>
@@ -144,6 +202,7 @@ supported by:<br><br>
 <div id="proflashext" class="proflashext"><div id="proflash" class="proflash">
 </div><br><br></div>
 %s
+%s
 </div>';
     
   /* Templates. */
@@ -177,7 +236,7 @@ supported by:<br><br>
    }
 </SCRIPT>
 <?php
-    printf($brisk_header_form, '');
+    printf($brisk_header_form, '', '');
 ?> 
 
 <!--  =========== tables ===========  -->
@@ -238,7 +297,7 @@ Digita il tuo nickname per accedere ai tavoli della briscola.<br><br>
    var myfrom = "index_php";
    window.onload = function() {
 <?php
-if ($BRISK_DEBUG == "debugtable") {
+if ($BRISK_SHOWHTML == "debugtable") {
 ?>
      room_checkspace(12,8,50);
 <?php
@@ -267,7 +326,8 @@ else {
 
 </SCRIPT>
 <?php
-    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();"><br><br><br>');
+    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();"><br><br><br>',
+          $brisk_donate);
 ?> 
 <!--  =========== tables ===========  -->
 <div id="tables" class="tables">