basic user page, list available users and link to start a new game
authorarun <arun@nubati.net>
Fri, 8 Dec 2006 11:05:21 +0000 (11:05 +0000)
committerarun <arun>
Fri, 8 Dec 2006 11:05:21 +0000 (11:05 +0000)
db.php
functions.php
index.php

diff --git a/db.php b/db.php
index 52f51d9d0c0afa6c581219d33979587df4f52044..10c5de2ae3e62deecd928bb32cea868767fd1a9c 100644 (file)
--- a/db.php
+++ b/db.php
@@ -7,8 +7,8 @@
 function DB_open()
 {
   global $DB;
 function DB_open()
 {
   global $DB;
-  if ( $DB = mysql_connect('localhost','dokodb', 'doko') )
-    mysql_select_db('doko') or die('Could not select database'); 
+  if ( $DB = mysql_connect('mysql.nubati.net','doko', '$DoKo#.') )
+    mysql_select_db('dokodb') or die('Could not select database'); 
   else
     die (mysql_error());
   
   else
     die (mysql_error());
   
@@ -339,4 +339,14 @@ function DB_get_hash_from_game_and_pos($id,$pos)
     return "";
 }
 
     return "";
 }
 
+function DB_get_all_names()
+{
+  $names  = array();
+
+  $result = mysql_query("SELECT fullname FROM User");
+  while($r = mysql_fetch_array($result,MYSQL_NUM))
+    $names[] = $r[0];
+
+  return $names;
+}
 ?>
\ No newline at end of file
 ?>
\ No newline at end of file
index a52ad7a86cca139b4660d31f34c75b9ab4230977..49e0a1d21aade548bee7f718417e840bcfc50880 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 = 1;
+$debug = 0;
 
 $last=-2;
 
 
 $last=-2;
 
index f0bfad58f81f5a28dfd27275d1b28bc124e1e9fe..7db439913a9bf7c7bccd4c0bbb7f6bb3ba919655 100644 (file)
--- a/index.php
+++ b/index.php
@@ -52,8 +52,8 @@ DB_open();
 if(isset($_REQUEST["new"]))
   {
 ?>
 if(isset($_REQUEST["new"]))
   {
 ?>
-    <p> no game in progress, please input 4 names and email addresses, please make sure that the addresses are correct! </p>
- <form action="index.php" method="post">
+    <p>Please add 4 names, please make sure that the names are correct! </p>
      <form action="index.php" method="post">
    Name:  <input name="PlayerA" type="text" size="10" maxlength="20" /> 
    Name:  <input name="PlayerB" type="text" size="10" maxlength="20" /> 
    Name:  <input name="PlayerC" type="text" size="10" maxlength="20" /> 
    Name:  <input name="PlayerA" type="text" size="10" maxlength="20" /> 
    Name:  <input name="PlayerB" type="text" size="10" maxlength="20" /> 
    Name:  <input name="PlayerC" type="text" size="10" maxlength="20" /> 
@@ -389,7 +389,11 @@ else if(isset($_REQUEST["me"]))
          $myturn = 1;
        else
          $myturn = 0;
          $myturn = 1;
        else
          $myturn = 0;
+
+       if(isset($_REQUEST["comment"]))
+         {
        
        
+         }  
        /* do we want to play a card? */
        if(isset($_REQUEST["card"]) && $myturn)
          {
        /* do we want to play a card? */
        if(isset($_REQUEST["card"]) && $myturn)
          {
@@ -480,7 +484,7 @@ else if(isset($_REQUEST["me"]))
            foreach($mycards as $card) 
              display_link_card($card);
 ?>
            foreach($mycards as $card) 
              display_link_card($card);
 ?>
-    <br />A short comment:<input name="comment" type="text" size="30" maxlength="50" /> 
+    <br />A short comments:<input name="comment" type="text" size="30" maxlength="50" /> 
     <input type="hidden" name="me" value="<?php echo $me; ?>" />
     <input type="submit" value="move" />
  </form>
     <input type="hidden" name="me" value="<?php echo $me; ?>" />
     <input type="submit" value="move" />
  </form>
@@ -538,7 +542,13 @@ else if(isset($_REQUEST["me"]))
     if($ok)
       {
        echo "ok. your logged in, now what? :)<br />";
     if($ok)
       {
        echo "ok. your logged in, now what? :)<br />";
-       
+       $names = DB_get_all_names();
+       echo "<p>registered players:<br />\n";
+       foreach ($names as $name)
+         echo "$name <br />\n";
+       echo "</p>\n";
+       echo "<p>Want to start a new game? remember 4 names from the list above and visit ".
+         "<a href=\"http://doko.nubati.net/database/index.php?new\">this page.</a></p>";
       }
     else
       {
       }
     else
       {