diff usrlogin.php @ 554:eee6b811f58a

Add comments.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 16 Dec 2013 03:57:21 +0200
parents aac3bdd73ec1
children ed2247111fdd
line wrap: on
line diff
--- a/usrlogin.php	Mon Dec 16 02:51:19 2013 +0200
+++ b/usrlogin.php	Mon Dec 16 03:57:21 2013 +0200
@@ -31,6 +31,9 @@
 $sql = stPrepareSQL("SELECT * FROM votekeys WHERE key=%s", $password);
 if (($key = stFetchSQL($sql)) !== false)
 {
+  //
+  // Validate login based on current vote key mode
+  //
   switch (stGetSetting("voteKeyMode"))
   {
     case VOTE_ACTIVATE:
@@ -45,6 +48,9 @@
       break;
   }
 
+  //
+  // Okay, attempt to set up session if no error
+  //
   if ($error == 0)
   {
     if (!stSessionStart(SESS_USER, $password, "userTimeout"))
@@ -65,8 +71,14 @@
   $error = 1;
 }
 
+
+// Select destination page based on error status and
+// if error page has been set. Use common destination page
+// if no error or no error page.
 $nextPage = ($error != 0 && $errorPage !== FALSE) ? $errorPage : $gotoPage;
 
+// Okay, if destination page is set, go there.
+// Otherwise, just use the default page.
 header("Location: ".
   ($nextPage !== FALSE ? $nextPage : stGetSetting("defaultPage")).
   ($error ? "?error=".$error : ""));