LAYOUT: fixed some overlaying of boxes (but not all), made userpage a bit nicer
authorArun Persaud <arun@nubati.net>
Sat, 4 Aug 2007 16:52:56 +0000 (09:52 -0700)
committerArun Persaud <arun@nubati.net>
Sat, 4 Aug 2007 16:52:56 +0000 (09:52 -0700)
a bit more html on the user page and the session are displayed differently now.
Also fixed a few small html errors, moved the link for new games into the menu
and probably some small things I don't remember right now ;)

css/standard.css
functions.php
index.php
output.php

index 5bca2aea8a422816fcb58e7f14287ce28cb341e1..32060e288634f16a6b8c2e660cc5dcb2c0480bae 100644 (file)
@@ -7,6 +7,8 @@
 
 .main {
   min-height: 40em;
 
 .main {
   min-height: 40em;
+//  margin-left: 12.5em;
+//  margin-right: 12.5em;
 }
 
 .footer { 
 }
 
 .footer { 
@@ -294,10 +296,11 @@ ul.tricks li div div span.comment span{
   text-align:center;
 }
 
   text-align:center;
 }
 
-.gameinfo {
-  position:absolute;
-  top:9em;
-  right:0em;
+.gameinfo, .useroptions {
+  float:right;
+  margin:1em;
+  margin-top:3em;
+  margin-right:0em;
 
   width:12em;
 
 
   width:12em;
 
@@ -310,11 +313,11 @@ ul.tricks li div div span.comment span{
   background-color: #eee;
 }
 
   background-color: #eee;
 }
 
-
 .usermenu {
 .usermenu {
-  position:absolute;
-  top:9em;
-  left:0em;
+  float: left;
+  margin:1em;
+  margin-top:3em;
+  margin-left:0em;
 
   width: 12em;
 
 
   width: 12em;
 
@@ -341,19 +344,6 @@ ul.tricks li div div span.comment span{
   background-color:#afa; 
 }
 
   background-color:#afa; 
 }
 
-.useroptions{
-  float:right;
-  padding-left:0.3em;
-  border-left: 1px solid #aaa;
-  border-bottom: 1px solid #aaa;
-}
-.useroptions h4 {
-    margin:0.1em;
-    margin-left:0em;
-    padding:0.1em;
-    padding-left:0em;
-    text-align:left;
-}
 
 .cardinput {
   display:inline;
 
 .cardinput {
   display:inline;
index 57945ef980ed863758a828f609f828809f955e13..45fa0ae7789b69d558cf834313faa8766992ffb9 100644 (file)
@@ -821,6 +821,9 @@ function display_user_menu()
       echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
     }
   
       echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
     }
   
+  echo "<hr> <a href=\"".$host."?new\">start a new game</a>";
+              
+
   echo
     "<hr />Report bugs in the <a href=\"". $wiki."\">wiki</a>\n";
   echo  "</div>\n";
   echo
     "<hr />Report bugs in the <a href=\"". $wiki."\">wiki</a>\n";
   echo  "</div>\n";
index cfef15bed5573e6741ec2cbff6ec036f264a5a4e..c2d93d2e8c4fc28a0e8700f27b1370a0d8846fdc 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1574,14 +1574,14 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
        {
         $ok = 1;
 
        {
         $ok = 1;
 
-        $uid = DB_get_userid_by_email($email);
-        if(!$uid)
+        $myid = DB_get_userid_by_email($email);
+        if(!$myid)
           $ok = 0;
         
         if($ok)
           {
             /* check how many entries in recovery table */
           $ok = 0;
         
         if($ok)
           {
             /* check how many entries in recovery table */
-            $number = DB_get_number_of_passwords_recovery($uid);
+            $number = DB_get_number_of_passwords_recovery($myid);
             
             /* if less than N recent ones, add a new one and send out email */
             if( $number < 5 )
             
             /* if less than N recent ones, add a new one and send out email */
             if( $number < 5 )
@@ -1605,7 +1605,7 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
                   " also still be valid until you set a new one\n";
                 mymail($email,$EmailName."recovery ",$message);
                 
                   " also still be valid until you set a new one\n";
                 mymail($email,$EmailName."recovery ",$message);
                 
-                DB_set_recovery_password($uid,md5($newpw));
+                DB_set_recovery_password($myid,md5($newpw));
               }
             else
               {
               }
             else
               {
@@ -1632,13 +1632,13 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
         $password = md5($password);
        
        $ok  = 1;
         $password = md5($password);
        
        $ok  = 1;
-       $uid = DB_get_userid_by_email_and_password($email,$password);
-       if(!$uid)
+       $myid = DB_get_userid_by_email_and_password($email,$password);
+       if(!$myid)
         $ok = 0;
        
        if($ok)
         {
         $ok = 0;
        
        if($ok)
         {
-          DB_get_PREF($uid);
+          DB_get_PREF($myid);
 
           if(myisset("setpref"))
             {
 
           if(myisset("setpref"))
             {
@@ -1648,12 +1648,12 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
                 case "germancards":
                 case "englishcards":
                   $result = mysql_query("SELECT * from User_Prefs".
                 case "germancards":
                 case "englishcards":
                   $result = mysql_query("SELECT * from User_Prefs".
-                                        " WHERE user_id='$uid' AND pref_key='cardset'" );
+                                        " WHERE user_id='$myid' AND pref_key='cardset'" );
                   if( mysql_fetch_array($result,MYSQL_NUM))
                     $result = mysql_query("UPDATE User_Prefs SET value=".DB_quote_smart($setpref).
                   if( mysql_fetch_array($result,MYSQL_NUM))
                     $result = mysql_query("UPDATE User_Prefs SET value=".DB_quote_smart($setpref).
-                                          " WHERE user_id='$uid' AND pref_key='cardset'" );
+                                          " WHERE user_id='$myid' AND pref_key='cardset'" );
                   else
                   else
-                    $result = mysql_query("INSERT INTO User_Prefs VALUES(NULL,'$uid','cardset',".
+                    $result = mysql_query("INSERT INTO User_Prefs VALUES(NULL,'$myid','cardset',".
                                           DB_quote_smart($setpref).")");
                   echo "Ok, changed you preferences for the cards.\n";
                   break;
                                           DB_quote_smart($setpref).")");
                   echo "Ok, changed you preferences for the cards.\n";
                   break;
@@ -1690,7 +1690,7 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
                     case '1':
                       echo "Changed the password.<br />";
                       mysql_query("UPDATE User SET password='".md5($_REQUEST["password1"]).
                     case '1':
                       echo "Changed the password.<br />";
                       mysql_query("UPDATE User SET password='".md5($_REQUEST["password1"]).
-                                  "' WHERE id=".DB_quote_smart($uid));
+                                  "' WHERE id=".DB_quote_smart($myid));
                       break;
                     }
                   /* set password */
                       break;
                     }
                   /* set password */
@@ -1698,10 +1698,10 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
             }
           else /* output default user page */
             {
             }
           else /* output default user page */
             {
-              $time     = DB_get_user_timestamp($uid);
+              $time     = DB_get_user_timestamp($myid);
               $unixtime = strtotime($time);
               
               $unixtime = strtotime($time);
               
-              $offset   = DB_get_user_timezone($uid);
+              $offset   = DB_get_user_timezone($myid);
               $zone     = return_timezone($offset);
               date_default_timezone_set($zone);
 
               $zone     = return_timezone($offset);
               date_default_timezone_set($zone);
 
@@ -1716,17 +1716,20 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
               
               echo "last login: ".date("r",$unixtime)."<br />";
               
               
               echo "last login: ".date("r",$unixtime)."<br />";
               
-              DB_update_user_timestamp($uid);
-              
-              echo "<p>These are your games that haven't started yet:<br />\n";
+              DB_update_user_timestamp($myid);
+            
+              display_user_menu();
+  
+              echo "<h4>These are your games that haven't started yet:</h4>\n";
               $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand".
                                     " LEFT JOIN Game On Hand.game_id=Game.id".
               $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand".
                                     " LEFT JOIN Game On Hand.game_id=Game.id".
-                                    " WHERE Hand.user_id='$uid' AND Game.status='pre'".
+                                    " WHERE Hand.user_id='$myid' AND Game.status='pre'".
                                     " ORDER BY Game.session" );
                                     " ORDER BY Game.session" );
+              echo "<p>\n";
               while( $r = mysql_fetch_array($result,MYSQL_NUM))
                 {
                   echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>";
               while( $r = mysql_fetch_array($result,MYSQL_NUM))
                 {
                   echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>";
-                  if($r[3]==$uid || $r[3]==NULL)
+                  if($r[3]==$myid || $r[3]==NULL)
                     echo "(it's <strong>your</strong> turn)\n";
                   else
                     {
                     echo "(it's <strong>your</strong> turn)\n";
                   else
                     {
@@ -1742,17 +1745,18 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
                 }
               echo "</p>\n";
 
                 }
               echo "</p>\n";
 
-              echo "<p>These are the games you are playing in:<br />\n";
+              echo "<h4>These are the games you are playing in:</h4>\n";
               $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand".
                                     " LEFT JOIN Game On Hand.game_id=Game.id".
               $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand".
                                     " LEFT JOIN Game On Hand.game_id=Game.id".
-                                    " WHERE Hand.user_id='$uid' AND Game.status='play'".
+                                    " WHERE Hand.user_id='$myid' AND Game.status='play'".
                                     " ORDER BY Game.session" );
                                     " ORDER BY Game.session" );
+              echo "<p>\n";
               while( $r = mysql_fetch_array($result,MYSQL_NUM))
                 {
                   echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>";
                   if($r[3])
                     {
               while( $r = mysql_fetch_array($result,MYSQL_NUM))
                 {
                   echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>";
                   if($r[3])
                     {
-                      if($r[3]==$uid)
+                      if($r[3]==$myid)
                         echo "(it's <strong>your</strong> turn)\n";
                       else
                         {
                         echo "(it's <strong>your</strong> turn)\n";
                       else
                         {
@@ -1769,22 +1773,31 @@ else if( myisset("email","password") || isset($_SESSION["name"]) )
               echo "</p>\n";
               
               
               echo "</p>\n";
               
               
-              echo "<p>And these are your games that are already done:<br />Game: \n";
+              echo "<h4>And these are your games that are already done:</h4>\n";
+              echo "<p>Session:\n";
               $output = array();
               $result = mysql_query("SELECT hash,game_id from Hand".
                                     " LEFT JOIN Game ON Game.id=Hand.game_id".
               $output = array();
               $result = mysql_query("SELECT hash,game_id from Hand".
                                     " LEFT JOIN Game ON Game.id=Hand.game_id".
-                                    " WHERE user_id='$uid' AND Game.status='gameover'".
+                                    " WHERE user_id='$myid' AND Game.status='gameover'".
                                     " ORDER BY Game.session,Game.create_date" );
                                     " ORDER BY Game.session,Game.create_date" );
+              $gamenrold = 0;
+              echo "<br />\n";
               while( $r = mysql_fetch_array($result,MYSQL_NUM))
               while( $r = mysql_fetch_array($result,MYSQL_NUM))
-                $output[] = "<a href=\"".$host."?me=".$r[0]."\">".DB_format_gameid($r[1])." </a>";
-              echo implode(", ",$output)."</p>\n";
-              
+                {
+                  $game = DB_format_gameid($r[1]);
+                  $gamenr = (int) $game;
+                  if($gamenrold < $gamenr)
+                    {
+                      $gamenrold = $gamenr;
+                      echo "<br /> $gamenr: ";
+                    }
+                  echo "<a href=\"".$host."?me=".$r[0]."\">I </a>";
+                }
+              echo "</p>\n";
               $names = DB_get_all_names();
               $names = DB_get_all_names();
-              echo "<p>Registered players:<br />\n";
+              echo "<h4>Registered players:</h4>\n<p>\n";
               echo implode(", ",$names)."\n";
               echo "</p>\n";
               echo implode(", ",$names)."\n";
               echo "</p>\n";
-              
-              echo "<p>Want to start a new game? Visit <a href=\"".$host."?new\">this page.</a></p>";
             }
         }
        else
             }
         }
        else
index 4485db430ef888223b12d5c0246407874b4ac6cc..88bc9f21a1d2b6bbd6050e2260d8a44e9d9379a6 100644 (file)
@@ -8,7 +8,7 @@ function output_user_settings($email,$password)
 
   echo "<div class=\"useroptions\">\n";
   echo "<h4> Settings </h4>\n";
 
   echo "<div class=\"useroptions\">\n";
   echo "<h4> Settings </h4>\n";
-  echo "<a href=\"index.php?passwd=ask\">change password</a><br /";
+  echo "<a href=\"index.php?passwd=ask\">change password</a><br />";
 
   if( $PREF["cardset"] == "english" )
     echo "<a href=\"index.php?setpref=germancards\">use german cards</a><br />";
 
   if( $PREF["cardset"] == "english" )
     echo "<a href=\"index.php?setpref=germancards\">use german cards</a><br />";