summaryrefslogtreecommitdiffstats
path: root/include/welcome.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-04-26 11:52:49 -0700
committerArun Persaud <arun@nubati.net>2008-04-26 11:52:49 -0700
commit09515348107d9aab7823a12d31b082a2ebb75555 (patch)
tree2e6c01eb6fdc07390c73cb46142c5efda39f567d /include/welcome.php
parent0c5b3eeca3006f61dd326a86e8989c52694d581b (diff)
downloade-DoKo-09515348107d9aab7823a12d31b082a2ebb75555.tar.gz
e-DoKo-09515348107d9aab7823a12d31b082a2ebb75555.tar.bz2
e-DoKo-09515348107d9aab7823a12d31b082a2ebb75555.zip
CLEANUP: make index.php very short and move everything in separate files
created an include dir and almost everything that was in index.php is now in separate files and gets only included in index.php... makes index.php look a lot nicer ;) Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/welcome.php')
-rw-r--r--include/welcome.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/welcome.php b/include/welcome.php
new file mode 100644
index 0000000..7aeaf78
--- /dev/null
+++ b/include/welcome.php
@@ -0,0 +1,26 @@
+<?php
+/* 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;
+
+/* this outputs the default home page with some extra statistics on it */
+
+$pre[0]=0;$game[0]=0;$done[0]=0;
+$r=mysql_query("SELECT COUNT(id) FROM Game GROUP BY status");
+if($r) {
+ $pre = mysql_fetch_array($r,MYSQL_NUM);
+ $game = mysql_fetch_array($r,MYSQL_NUM);
+ $done = mysql_fetch_array($r,MYSQL_NUM);
+ }
+
+$r=mysql_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' ");
+if($r)
+ $avgage= mysql_fetch_array($r,MYSQL_NUM);
+ else
+ $avgage[0]=0;
+
+output_home_page($pre[0],$game[0],$done[0],$avgage[0]);
+
+?> \ No newline at end of file