2 /* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
4 * This file is part of e-DoKo.
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.
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.
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/>.
21 /* make sure that we are not called from outside the scripts,
22 * use a variable defined in config.php to check this
27 /* this outputs the default home page with some extra statistics on it */
29 $pre[0]=0;$game[0]=0;$done[0]=0;
31 $r=DB_query("SELECT COUNT(*) FROM Game where status='pre'");
32 if($r) $pre = DB_fetch_array($r);
34 $r=DB_query("SELECT COUNT(*) FROM Game where status='play'");
35 if($r) $game = DB_fetch_array($r);
37 $r=DB_query("SELECT COUNT(*) FROM Game where status='gameover'");
38 if($r) $done = DB_fetch_array($r);
41 $r=DB_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' ");
43 $avgage= DB_fetch_array($r);
52 echo "\n\n<div class=\"login\">\n";
54 echo "<p> Play Doppelkopf online.</p>".
55 "<p> For more information please visit our <a href=\"$WIKI\">wiki</a>. </p>";
57 <ul class="loginregister">
61 <form class="dologin" action="index.php?action=login" method="post">
63 <label for="email">Email:</label>
64 <input type="email" id="email" name="email" size="20" maxlength="30" autofocus /> <br />
66 if (!("autofocus" in document.createElement("input"))) {
67 document.getElementById("email").focus();
70 <label for="password">Password:</label>
71 <input type="password" id="password" name="password" size="20" maxlength="30" /> <br />
72 <input type="submit" class="submitbutton" name="login" value="login" />
73 <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" />
78 <label for="openid_url">Openid:</label>
79 <input type="text" id="openid_url" name="openid_url" size="20" maxlength="50" placeholder="http://username.openid.net"/> <br />
80 <p>See <a href="http://openid.net">openid.net</a> for more information.</p>
81 <input type="submit" class="submitbutton" name="login" value="Sign in" /><br />
86 /* check for openid information */
90 if(myisset('openid_url'))
91 $openid_url = $_REQUEST['openid_url'];
92 if(myisset('openidname'))
93 $name = $_REQUEST['openidname'];
94 if(myisset('openidemail'))
95 $email = $_REQUEST['openidemail'];
97 echo '<div class="doregister">'; echo "\n";
98 echo ' <form action="index.php?action=register" method="post">'; echo "\n";
99 echo ' <fieldset>'; echo "\n";
100 echo ' <table>'; echo "\n";
101 echo ' <tr>'; echo "\n";
102 echo ' <td><label for="Rfullname">Full name:</label></td>'; echo "\n";
103 echo " <td><input type=\"text\" id=\"Rfullname\" name=\"Rfullname\" size=\"20\" maxlength=\"30\" value=\"$name\" /> </td>"; echo "\n";
104 echo ' </tr><tr>'; echo "\n";
105 echo ' <td><label for="Remail">Email:</label></td>'; echo "\n";
106 echo " <td><input type=\"text\" id=\"Remail\" name=\"Remail\" size=\"20\" maxlength=\"30\" value=\"$email\" /></td>"; echo "\n";
107 echo ' </tr><tr>'; echo "\n";
110 echo ' <td><label for="Rpassword">Password:</label></td>'; echo "\n";
111 echo ' <td><input type="password" id="Rpassword" name="Rpassword" size="20" maxlength="30" /></td>'; echo "\n";
112 echo ' </tr><tr>'; echo "\n";
116 echo ' <td><label for="Ropenid">OpenId:</label></td>'; echo "\n";
117 echo ' <td><input type="text" id="Ropenid" name="Ropenid" size="20" maxlength="50" value="'.htmlentities($openid_url).'" /></td>'; echo "\n";
118 echo ' </tr><tr>'; echo "\n";
120 echo ' <td><label for="Rtimezone">Timezone:</label></td>'; echo "\n";
121 echo ' <td>';echo "\n";
123 output_select_timezone("Rtimezone");
129 /* random number to select robotproof question */
130 $rand_number = mt_rand(0,3); /* to get numbers between 0 and 4 */
131 $Robotproof = "Robotproof".$rand_number;
133 <td><label for="Robotproof">Please answer this question: <?php echo output_robotproof($rand_number); ?></label></td>
135 echo "<td><input type=\"text\" id=\"$Robotproof\" name=\"$Robotproof\" size=\"20\" maxlength=\"30\" /></td>\n";
138 <td colspan="2"> <input type="submit" value="register" /></td>
141 <?php if($openid_url=='')
142 echo "<p><br /><strong> IMPORTANT: passwords are going over the net as clear text, so pick an easy password. ".
143 "No need to pick anything complicated here ;)</strong><p/>";
145 echo "<p> <strong>N.B. Your email address will be exposed to other players whom you play games with. ";
146 echo "</strong></p>";
152 echo "<h4>Some statistics:</h4>";
155 echo "<p> At the moment there are no games that are being started ";
157 echo "<p> At the moment there is one game that is being started ";
159 echo "<p> At the moment there are $pre games that are being started ";
164 echo "zero games that are ongoing. ";
166 echo "one game that is ongoing. ";
168 echo "$game games that are ongoing. ";
173 echo "No game has been completed on this server. </p>";
175 echo "One game has been completed on this server. </p>";
177 echo "$done games have been completed on this server. Average time of a game: $avgage days</p>";