CLEANUP: some more comments, also removed some debug messages
authorArun Persaud <arun@nubati.net>
Mon, 18 Aug 2008 04:41:39 +0000 (21:41 -0700)
committerArun Persaud <arun@nubati.net>
Mon, 18 Aug 2008 04:41:39 +0000 (21:41 -0700)
Signed-off-by: Arun Persaud <arun@nubati.net>
include/cancelgame.php
include/login.php
include/logout.php
include/register.php

index 43d32740c93014bded9fed6ef61a3d1626d906e6..357d226d9becc6a3b0a86915c5fd075d6094d33a 100644 (file)
@@ -1,12 +1,14 @@
 <?php
-/* make sure that we are not called from outside the scripts, 
+/* make sure that we are not called from outside the scripts,
  * use a variable defined in config.php to check this
  */
 if(!isset($HOST))
   exit;
 
+/* display the menu */
 output_status();
 
+/* you should only get here from a game page, so $me should be set */
 if(!myisset("me"))
   {
     echo "Hmm, you really shouldn't mess with the urls.<br />\n";
@@ -38,6 +40,7 @@ if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */
       "Game ".DB_format_gameid($gameid).
       " has been canceled since nothing happend for a while and $myname requested it.\n";
 
+    /* email to all players */
     $userids = DB_get_all_userid_by_gameid($gameid);
     foreach($userids as $user)
       {
@@ -51,6 +54,6 @@ if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */
     echo "<p style=\"background-color:red\";>Game ".DB_format_gameid($gameid).
       " has been canceled.<br /><br /></p>";
   }
- else
+ else /* game can't be canceled yet */
    echo "<p>You need to wait longer before you can cancel a game...</p>\n";
 ?>
\ No newline at end of file
index 346c71e53e53b79173f9a64b1ec75ae1f43530db..ea8d8effac122ab63df92334ad1a08481c2b9439 100644 (file)
@@ -1,13 +1,14 @@
 <?php
-/* make sure that we are not called from outside the scripts, 
+/* make sure that we are not called from outside the scripts,
  * use a variable defined in config.php to check this
  */
 if(!isset($HOST))
   exit;
 
+/* check if login information is present */
 if(!myisset("email","password"))
   {
-    "can't log you in";
+    echo "can't log you in... missing login information.";
   }
 else
   {
@@ -17,15 +18,15 @@ else
     /* verify password and email */
     if(strlen($password)!=32)
       $password = md5($password);
-    
+
     $ok  = 1;
     $myid = DB_get_userid('email-password',$email,$password);
     if(!$myid)
       $ok = 0;
-    
+
     if($ok)
       {
-       /* user information is ok */
+       /* user information is ok, set session variabel */
        $myname = DB_get_name('email',$email);
        $_SESSION["name"] = $myname;
       }
index f2ebbaf00199c43842624d6d94810817cd94d8bd..3acabc30a94507aaa82475228f33b30991dadc95 100644 (file)
@@ -1,13 +1,13 @@
 <?php
-/* make sure that we are not called from outside the scripts, 
+/* make sure that we are not called from outside the scripts,
  * use a variable defined in config.php to check this
  */
 if(!isset($HOST))
   exit;
 
-/* distroy the session */
+/* to log a player out, all we need to do is to distroy the session */
 session_unset();
 session_destroy();
 $_SESSION = array();
-    
+
 ?>
\ No newline at end of file
index 03be8038cda9a04c02403fc253e3f78446a1426a..d32a8b869d1140dc145180632adba2f192b05d9a 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/* make sure that we are not called from outside the scripts, 
+/* make sure that we are not called from outside the scripts,
  * use a variable defined in config.php to check this
  */
 if(!isset($HOST))
@@ -9,42 +9,45 @@ if(!isset($HOST))
 if(myisset("Rfullname","Remail","Rpassword","Rtimezone") )
   {
     global $HOST,$INDEX;
+
+    /* is this name already in use/ */
     $ok=1;
     if(DB_get_userid('name',$_REQUEST["Rfullname"]))
       {
        echo "please chose another name<br />";
        $ok=0;
       }
+    /* check if email address is already used */
     if(DB_get_userid('email',$_REQUEST["Remail"]))
       {
        echo "this email address is already used ?!<br />";
        $ok=0;
       }
+
+    /* everything ok, go ahead and create user */
     if($ok)
       {
        $r=DB_query("INSERT INTO User VALUES(NULL,".DB_quote_smart($_REQUEST["Rfullname"]).
                    ",".DB_quote_smart($_REQUEST["Remail"]).
                    ",".DB_quote_smart(md5($_REQUEST["Rpassword"])).
-                   ",".DB_quote_smart($_REQUEST["Rtimezone"]).",NULL,NULL)"); 
-       
+                   ",".DB_quote_smart($_REQUEST["Rtimezone"]).",NULL,NULL)");
+
        if($r)
          {
            /* Set session, so that new user doesn't need to log in */
            $myname = DB_get_name('email',$_REQUEST['Remail']);
            $_SESSION["name"] = $myname;
-           
-           echo "myname $myname --";
-           
+
            echo " Welcome to e-DoKo, you are now registered, please visit the".
              " <a href=\"".$HOST.$INDEX."\">homepage</a> to continue.";
          }
        else
          echo " something went wrong, couldn't add you to the database, please contact $ADMIN_NAME at $ADMIN_EMAIL.";
       }
-   }
-/* page for registration */
+  }
  else
    {
+     /* No information for new user given, ouput a page for registration */
      echo "IMPORTANT: passwords are going over the net as clear text, so pick an easy password. No need to pick anything complicated here ;)<br /><br />";
      ?>
         <form action="index.php?action=register" method="post">
@@ -74,6 +77,4 @@ if(myisset("Rfullname","Remail","Rpassword","Rtimezone") )
         </form>
 <?php
    }
-
-
 ?>
\ No newline at end of file