BUGFIX: typo in scoring algorithm
[e-DoKo.git] / include / welcome.php
1 <?php
2 /* make sure that we are not called from outside the scripts, 
3  * use a variable defined in config.php to check this
4  */
5 if(!isset($HOST))
6   exit;
7
8 /* this outputs the default home page with some extra statistics on it */
9
10 $pre[0]=0;$game[0]=0;$done[0]=0;
11 $r=mysql_query("SELECT COUNT(id) FROM Game GROUP BY status");
12 if($r) {
13   $pre  = mysql_fetch_array($r,MYSQL_NUM);
14   $game = mysql_fetch_array($r,MYSQL_NUM);
15   $done = mysql_fetch_array($r,MYSQL_NUM);
16  }
17
18 $r=mysql_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' ");
19 if($r)
20   $avgage= mysql_fetch_array($r,MYSQL_NUM);
21  else
22    $avgage[0]=0;
23
24 output_home_page($pre[0],$game[0],$done[0],$avgage[0]);
25
26 ?>