CLEANUP: removed ereg-functions (deprecated in newer php versions)
[e-DoKo.git] / include / welcome.php
1 <?php
2 /* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
3  *
4  *   This file is part of e-DoKo.
5  *
6  *   e-DoKo is free software: you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation, either version 3 of the License, or
9  *   (at your option) any later version.
10  *
11  *   e-DoKo is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU General Public License for more details.
15  *
16  *   You should have received a copy of the GNU General Public License
17  *   along with e-DoKo.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 /* make sure that we are not called from outside the scripts,
22  * use a variable defined in config.php to check this
23  */
24 if(!isset($HOST))
25   exit;
26
27 /* this outputs the default home page with some extra statistics on it */
28
29 $pre[0]=0;$game[0]=0;$done[0]=0;
30
31 $r=DB_query("SELECT COUNT(*) FROM Game where status='pre'");
32 if($r)  $pre  = DB_fetch_array($r);
33
34 $r=DB_query("SELECT COUNT(*) FROM Game where status='play'");
35 if($r)  $game  = DB_fetch_array($r);
36
37 $r=DB_query("SELECT COUNT(*) FROM Game where status='gameover'");
38 if($r)  $done  = DB_fetch_array($r);
39
40
41 $r=DB_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' ");
42 if($r)
43   $avgage= DB_fetch_array($r);
44  else
45    $avgage[0]=0;
46
47 $pre    = $pre[0];
48 $game   = $game[0];
49 $done   = $done[0];
50 $avgage = $avgage[0];
51
52 echo "\n\n<div class=\"login\">\n";
53
54 echo "<p> If you want to play a game of Doppelkopf, you found the right place ;)</p>".
55 "<p> For more information please visit our <a href=\"$WIKI\">wiki</a>. </p>".
56 "<h4>Some statistics:</h4>";
57
58
59 if($pre == 0)
60   echo "<p> At the moment there are no games that are being started ";
61  else if($pre==1)
62    echo "<p> At the moment there is one games that is being started ";
63  else
64    echo "<p> At the moment there are $pre games that are being started ";
65
66 echo "and ";
67
68 if($game==0)
69   echo "zero games that are ongoing. ";
70  else if($game==1)
71    echo "one game that is ongoing. ";
72  else
73    echo "$game games that are ongoing. ";
74
75 echo "<br />\n";
76
77 if($done==0)
78   echo "No game has been completed on this server. </p>";
79  else if($done==1)
80    echo "One game has been completed on this server. </p>";
81  else
82    echo "$done games have been completed on this server. Average time of a game: $avgage days</p>";
83 ?>
84
85   <h4> Login/Register:</h4>
86   <p>
87   Please <a href="index.php?action=register">register</a>, in case you have not done that yet  <br />
88   or login with you email-address or name and password here:
89   </p>
90
91   <form action="index.php?action=login" method="post">
92   <fieldset>
93     <label for="email">Email:</label>
94     <input type="text" id="email" name="email" size="20" maxlength="30" /> <br />
95     <label for="password">Password:</label>
96     <input type="password" id="password" name="password" size="20" maxlength="30" /> <br />
97     <input type="submit" class="submitbutton" name="login" value="login" />
98     <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" />
99 <?php
100   if($OPENIDPATH)
101     {?>
102     <hr>
103     <p> Have an OpenID account? Sign in below <br />
104     <input type="text" id="openid_url" name="openid_url" size="20" maxlength="50" />
105     <input type="submit" class="submitbutton" name="login" value="Sign in" /><br />
106      e.g. http://username.openid.net. See <a href="http://openid.net">openid.net</a> for more information.</p>
107 <?php }?>
108   </fieldset>
109   </form>
110 </div>