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