bugfix? game entry wasn't added to DB, hope it is fixed now
authorarun <arun@nubati.net>
Fri, 8 Dec 2006 21:22:37 +0000 (21:22 +0000)
committerarun <arun>
Fri, 8 Dec 2006 21:22:37 +0000 (21:22 +0000)
functions.php
index.php

index c955d5cf4c9a59e9acacbe6627e8672d282ef7f9..1c7b29b6f239a7d9e592868f861a3a71d6d925ac 100644 (file)
@@ -6,7 +6,7 @@
 
 $host  = "http://doko.nubati.net/database/index.php";
 $wiki  = "http://wiki.nubati.net/index.php?title=EmailDoko";
 
 $host  = "http://doko.nubati.net/database/index.php";
 $wiki  = "http://wiki.nubati.net/index.php?title=EmailDoko";
-$debug = 0;
+$debug = 1;
 
 $last=-2;
 
 
 $last=-2;
 
index 8385576502c82c412843606ce9a0e4f96c3e067c..4a38ed8c9bde2ba498a86c0266c7aab1d9afe85c 100644 (file)
--- a/index.php
+++ b/index.php
@@ -98,8 +98,13 @@ else if( isset($_REQUEST["PlayerA"]) &&
     
     /* create game */
     $followup = NULL;
     
     /* create game */
     $followup = NULL;
-    if(isset($_REQUEST["followup"])) $followup= $_REQUEST["followup"];
-    mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', NULL, NULL,'pre',$followup ,NULL)");
+    if(isset($_REQUEST["followup"])) 
+      {
+       $followup= $_REQUEST["followup"];
+       mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', NULL, NULL,'pre','$followup' ,NULL)");
+      }
+    else
+      mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', NULL, NULL,'pre', NULL ,NULL)");
     $game_id = mysql_insert_id();
     
     
     $game_id = mysql_insert_id();
     
     
@@ -289,7 +294,13 @@ else if(isset($_REQUEST["me"]))
       case 'gameover': /* gameover and play, so that the tricks are visible for both */
        display_news();
        display_status();
       case 'gameover': /* gameover and play, so that the tricks are visible for both */
        display_news();
        display_status();
-               
+
+       $gamestatus =DB_get_game_status_by_gameid($gameid);
+       if($gamestatus == 'pre')
+         {
+           echo "you need to wait for the others... <br />";
+           break;
+         }
        /* get trick ids */
        $result = mysql_query("SELECT Hand_Card.card_id as card,".
                              "       User.fullname as name,".
        /* get trick ids */
        $result = mysql_query("SELECT Hand_Card.card_id as card,".
                              "       User.fullname as name,".
@@ -554,6 +565,12 @@ else if(isset($_REQUEST["me"]))
 
        DB_update_user_timestamp($uid);
 
 
        DB_update_user_timestamp($uid);
 
+       echo "<p>these are the games you are playing in:<br />\n";
+       $result = mysql_query("SELECT hash,game_id from Hand WHERE user_id='$uid' AND status<>'gameover'" );
+       while( $r = mysql_fetch_array($result,MYSQL_NUM))
+         echo "<a href=\"http://doko.nubati.net/database/index.php?me=".$r[0]."\">game #".$r[1]." </a><br />";
+       echo "</p>\n";
+
        $names = DB_get_all_names();
        echo "<p>registered players:<br />\n";
        foreach ($names as $name)
        $names = DB_get_all_names();
        echo "<p>registered players:<br />\n";
        foreach ($names as $name)