added more timezones
[e-DoKo.git] / index.php
index 31c497a74515f7e3ef7c4d89f6786f67cf69f17b..97028006cca1882ba7769b82d2ba8b6f4c70909d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,6 +1,13 @@
 <?php
 error_reporting(E_ALL);
 
+/* start a session, if it is not already running.
+ * This way people don't have to log in all the times. 
+ * The session variables can also be read out from different
+ * php scripts, so that the code can be easily split up across several files
+ */
+session_start();
+
 include_once("config.php");                /* needs to be first in list, since other includes use this */
 include_once("./include/output.php");      /* html output only */
 include_once("./include/db.php");          /* database only */
@@ -19,14 +26,7 @@ if(DB_open()<0)
     exit();
   }
 
-/* start a session, if it is not already running.
- * This way people don't have to log in all the times. 
- * The session variables can also be read out from different
- * php scripts, so that the code can be easily split up across several files
- */
-session_start();
-
-/* done major error checking, output header of HTML page */
+/* done major error checking, output5B header of HTML page */
 output_header();
 
 /* The rest of the file consists of handling user input.
@@ -57,9 +57,21 @@ switch($action)
     require './include/login.php'; 
     require './include/user.php';
     break;
+  case 'register':
+    require './include/register.php';
+    break;
+  case 'prefs':
+    require './include/preferences.php';
+    break;
   case 'game':
     require './include/game.php';
     break;
+  case 'stats':
+    if(isset($_SESSION["name"]))
+      require './include/stats.php';
+    else
+      require './include/welcome.php';
+    break;
   default:
     if(isset($_SESSION["name"]))
       require './include/user.php';
@@ -67,6 +79,11 @@ switch($action)
       require './include/welcome.php';
   }
 
+/* ask for login or display login info, needs to go at the end, so that we have the
+ * session-variable already set.
+ */
+output_status();
+
 output_footer();
 
 DB_close();