ccbaea5e864ba7339a5cdb089377bce8bc5d3226
[e-DoKo.git] / 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
12 $r=DB_query("SELECT COUNT(id) FROM Game GROUP BY status");
13 if($r) {
14   $pre  = DB_fetch_array($r);
15   $game = DB_fetch_array($r);
16   $done = DB_fetch_array($r);
17  }
18
19 $r=DB_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' ");
20 if($r)
21   $avgage= DB_fetch_array($r);
22  else
23    $avgage[0]=0;
24
25 $pre    = $pre[0];
26 $game   = $game[0];
27 $done   = $done[0];
28 $avgage = $avgage[0];
29
30 echo "<p> If you want to play a game of Doppelkopf, you found the right place ;)".
31 " For more information please visit our <a href=\"$WIKI\">wiki</a>. </p>";
32
33 if($pre == 0)
34   echo "<p> At the moment there are no games that are being started ";
35  else if($pre==1)
36    echo "<p> At the moment there is one games that is being started ";
37  else
38    echo "<p> At the moment there are $pre games that are being started ";
39
40 echo "and ";
41
42 if($game==0)
43   echo "zero games that are ongoing. ";
44  else if($game==1)
45    echo "one game that is ongoing. ";
46  else
47    echo "$game games that are ongoing. ";
48
49 echo "<br />\n";
50
51 if($done==0)
52   echo "No game has been completed on this server. </p>";
53  else if($done==1)
54    echo "One game has been completed on this server. </p>";
55  else
56    echo "$done games have been completed on this server. Average time of a game: $avgage days</p>";
57 ?>
58
59 <p> Please <a href="index.php?action=register">register</a>, in case you have not done that yet  <br />
60   or login with you email-address or name and password here:
61   </p>
62   <form action="index.php?action=login" method="post">
63   <fieldset>
64   <legend>Login</legend>
65   <table>
66   <tr>
67   <td><label for="email">Email:</label></td>
68   <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
69   </tr><tr>
70   <td><label for="password">Password:</label></td>
71   <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
72   </tr><tr>
73   <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
74   <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
75   </tr>
76   </table>
77   </fieldset>
78   </form>
79   
80