3 /* functions which only ouput html */
5 function display_links($email,$password)
8 echo "<div class=\"bug\">\n".
9 "Report bugs in the <a href=\"". $wiki."\">wiki</a>.<hr />\n";
10 output_link_to_user_page($email,$password);
15 function output_link_to_user_page($email,$password)
17 echo "<a href=\"index.php\"> go to my user page </a>";
22 function output_user_settings($email,$password)
26 echo "<div class=\"useroptions\">\n";
27 echo "<h4> Settings </h4>\n";
28 echo "<a href=\"index.php?passwd=ask\">change password</a><br /";
30 if( $PREF["cardset"] == "english" )
31 echo "<a href=\"index.php?setpref=germancards\">use german cards</a><br />";
33 echo "<a href=\"index.php?setpref=englishcards\">use english cards</a> <br />";
40 function output_register()
42 echo "IMPORTANT: passwords are going over the net as clear text, so pick an easy password. No need to pick anything complicated here ;)<br /><br />";
43 echo "TODO: figure out a better way to handle passwords <br />\n";
45 <form action="index.php" method="post">
47 <legend>Register</legend>
50 <td><label for="Rfullname">Full name:</label></td>
51 <td><input type="text" id="Rfullname" name="Rfullname" size="20" maxsize="30" /> </td>
53 <td><label for="Remail">Email:</label></td>
54 <td><input type="text" id="Remail" name="Remail" size="20" maxsize="30" /></td>
56 <td><label for="Rpassword">Password(will be displayed in cleartext on the next page):</label></td>
57 <td><input type="password" id="Rpassword" name="Rpassword" size="20" maxsize="30" /></td>
59 <td><label for="Rtimezone">Timezone:</label></td>
61 <select id="Rtimezone" name="Rtimezone" size="1">
62 <option value="1">Berlin</option>
63 <option value="-8">Berkeley</option>
64 <option value="13">Wellington</option>
66 (If your timezone is not listed, just select whatever you want and email the admin your correct time zone.)
69 <td colspan="2"> <input type="submit" value="register" /></td>
77 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
81 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
82 echo "<form action=\"index.php\" method=\"post\">\n";
83 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
84 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
85 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
86 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
87 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
88 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
89 echo " <input type=\"hidden\" name=\"call\" value=\"".$RULES["call"]."\" />\n";
90 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
91 echo " <input type=\"submit\" value=\"keep playing\" />\n";
97 function output_form_for_new_game($names)
101 <p>Please select four players (or use the randomly pre-selected names)</p>
102 <form action="index.php" method="post">
104 /* ask for player names */
105 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
107 srand((float) microtime() * 10000000);
108 $randkey = array_rand($names);
109 $rand = $names[$randkey];
110 echo " Name: <select name=\"$player\" size=\"1\" /> \n";
111 foreach($names as $name)
115 echo " <option selected=\"selected\">$name</option>\n";
118 echo " <option>$name</option>\n";
124 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
127 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
128 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
129 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
132 <p> schweinchen (both foxes), only in normal games or silent solos:
134 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
135 <li> <input type="radio" name="schweinchen" value="both" />
136 both become highest trump (automatic call at beginning of the game)
138 <li> <input type="radio" name="schweinchen" value="second" />
139 first one normal, second one becomes highest (call during the game) </li>
140 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
141 second one become highest only in case re/contra was announced (not working yet)
145 <p> Call Re/Contra, etc.:
147 <li><input type="radio" name="call" value="1st-own-card" checked="checked" />
148 Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
149 <li><input type="radio" name="call" value="5th-card" />
150 Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
151 <li><input type="radio" name="call" value="9-cards" />
152 Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
155 <input type="submit" value="start game" />
160 function display_card($card,$dir="english")
162 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
163 * convert even cards to the matching odd value */
165 if( $card/2 - (int)($card/2) == 0.5)
166 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" />\n";
168 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" />\n";
173 function display_link_card($card,$dir="english",$type="card")
175 if( $card/2 - (int)($card/2) == 0.5)
176 echo "<div class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" /></div>\n";
178 echo "<div class=\"cardinput\" ><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" /></div>\n";
182 function output_check_for_sickness($me,$mycards)
185 <form action="index.php" method="post">
187 do you want to play solo?
188 <select name="solo" size="1">
189 <option selected="selected">No</option>
190 <option>trumpless</option>
191 <option>trump</option>
192 <option>queen</option>
193 <option>jack</option>
194 <option>club</option>
195 <option>spade</option>
196 <option>heart</option>
203 if(check_wedding($mycards))
205 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
206 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
210 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
213 echo "Do you have poverty?";
214 if(count_trump($mycards)<4)
216 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
217 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
221 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
224 echo "Do you have too many nines?";
225 if(count_nines($mycards)>4)
227 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
228 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
232 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
235 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
236 echo "<input type=\"submit\" value=\"count me in\" />\n";
243 function output_form_calls($me)
245 if( can_call(120,$me) )
246 echo " re/contra (120):".
247 " <input type=\"radio\" name=\"call120\" value=\"yes\" /> <br />";
248 if( can_call(90,$me) )
250 " <input type=\"radio\" name=\"call90\" value=\"yes\" /> <br />";
251 if( can_call(60,$me) )
253 " <input type=\"radio\" name=\"call60\" value=\"yes\" /> ";
254 if( can_call(30,$me) )
256 " <input type=\"radio\" name=\"call30\" value=\"yes\" /> ";
257 if( can_call(0,$me) )
259 " <input type=\"radio\" name=\"call0\" value=\"yes\" /> ".
261 " <input type=\"radio\" name=\"call0\" value=\"no\" /> ";
265 function output_check_want_to_play($me)
268 <form action="index.php" method="post">
269 Do you want to play a game of DoKo?
270 yes<input type="radio" name="in" value="yes" />
271 no<input type="radio" name="in" value="no" /> <br />
273 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
275 echo "<input type=\"submit\" value=\"count me in\" />\n";
281 function output_home_page($pre,$game,$done,$avgtime)
284 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
287 echo "<p> At the moment there are no games that are being started ";
289 echo "<p> At the moment there is one games that is being started ";
291 echo "<p> At the moment there are $pre games that are being started ";
296 echo "zero games that are ongoing. ";
298 echo "one game that is ongoing. ";
300 echo "$game games that are ongoing. ";
305 echo "No game has been completed on this server. </p>";
307 echo "One game has been completed on this server. </p>";
309 echo "$done games have been completed on this server. Average time of a game: $avgtime days</p>";
312 <p> Please <a href="index.php?register">register</a>, in case you haven't done that yet <br />
313 or login with you email-address or name and password here:
315 <form action="index.php" method="post">
317 <legend>Login</legend>
320 <td><label for="email">Email:</label></td>
321 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
323 <td><label for="password">Password:</label></td>
324 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
326 <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
327 <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
337 function output_header()
341 <!DOCTYPE html PUBLIC
342 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
343 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
344 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
346 <title>e-Doko</title>
347 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
348 <link rel="stylesheet" type="text/css" href="css/standard.css" />
349 <script type="text/javascript">
351 if(document.getElementById){
354 if(document.getElementById("trick"+i))
355 document.getElementById("trick"+i).style.display = 'none';
357 document.getElementById("trick"+num).style.display = 'block';
360 function high_last(){
361 if(document.getElementById){
364 if(document.getElementById("trick"+i))
374 <body onload="high_last();">
376 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
383 function output_footer()
387 echo "<div class=\"footer\">\n";
388 echo "<p class=\"left\"> copyright 2006-2007 Arun Persaud <br />\n".
389 "Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />".
390 "- ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />".
391 "a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
392 echo "<p class=\"right\"> Revision: $REV; <br /><a href=\"http://svn.nubati.net/emaildoko/trunk/\">".
393 "http://svn.nubati.net/emaildoko/trunk/</a> <br />".
394 "<a href=\"http://www.dreamhost.com/green.cgi\">".
395 "<img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
396 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>".
407 function output_status($name)
409 echo "<div class=\"status\">\n";
411 echo " <a href=\"index.php?logout=1\">logout</a>\n";
418 function output_password_recovery($email,$password)
421 <form action="index.php" method="post">
423 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
424 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
425 echo " <input type=\"hidden\" name=\"passwd\" value=\"set\" />\n";
428 <legend>Password recovery</legend>
431 <td><label for="email">Old password:</label></td>
432 <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
434 <td><label for="password">New password:</label></td>
435 <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
437 <td><label for="password">Retype:</label></td>
438 <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
441 <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>