CLEANUP: moved the statistics page into the include directory
[e-DoKo.git] / index.php
index d1d2926f15271ab80566a4d252ee86c20317ac36..77a2c5bdc54640c269aeed16b52b28d593c19b65 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,11 +1,20 @@
 <?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 */
 include_once("./include/functions.php");   /* the rest */
 
+
 /* make sure that user has set all variables in config.php */
 config_check();
 
@@ -19,13 +28,6 @@ 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 */
 output_header();
 
@@ -63,6 +65,12 @@ switch($action)
   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';