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_check_want_to_play($me)
246 <form action="index.php" method="post">
247 Do you want to play a game of DoKo?
248 yes<input type="radio" name="in" value="yes" />
249 no<input type="radio" name="in" value="no" /> <br />
251 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
253 echo "<input type=\"submit\" value=\"count me in\" />\n";
259 function output_home_page($pre,$game,$done,$avgtime)
262 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
265 echo "<p> At the moment there are no games that are being started ";
267 echo "<p> At the moment there is one games that is being started ";
269 echo "<p> At the moment there are $pre games that are being started ";
274 echo "zero games that are ongoing. ";
276 echo "one game that is ongoing. ";
278 echo "$game games that are ongoing. ";
283 echo "No game has been completed on this server. </p>";
285 echo "One game has been completed on this server. </p>";
287 echo "$done games have been completed on this server. Average time of a game: $avgtime days</p>";
290 <p> Please <a href="index.php?register">register</a>, in case you haven't done that yet <br />
291 or login with you email-address or name and password here:
293 <form action="index.php" method="post">
295 <legend>Login</legend>
298 <td><label for="email">Email:</label></td>
299 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
301 <td><label for="password">Password:</label></td>
302 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
304 <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
305 <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
315 function output_header()
319 <!DOCTYPE html PUBLIC
320 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
321 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
322 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
324 <title>e-Doko</title>
325 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
326 <link rel="stylesheet" type="text/css" href="css/standard.css" />
327 <script type="text/javascript">
329 if(document.getElementById){
332 if(document.getElementById("trick"+i))
333 document.getElementById("trick"+i).style.display = 'none';
335 document.getElementById("trick"+num).style.display = 'block';
338 function high_last(){
339 if(document.getElementById){
342 if(document.getElementById("trick"+i))
352 <body onload="high_last();">
354 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
361 function output_footer()
365 echo "<div class=\"footer\">\n";
366 echo "<p class=\"left\"> copyright 2006-2007 Arun Persaud <br />\n".
367 "Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />".
368 "- ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />".
369 "a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
370 echo "<p class=\"right\"> Revision: $REV; <br /><a href=\"http://svn.nubati.net/emaildoko/trunk/\">".
371 "http://svn.nubati.net/emaildoko/trunk/</a> <br />".
372 "<a href=\"http://www.dreamhost.com/green.cgi\">".
373 "<img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
374 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>".
385 function output_status($name)
387 echo "<div class=\"status\">\n";
389 echo " <a href=\"index.php?logout=1\">logout</a>\n";
396 function output_password_recovery($email,$password)
399 <form action="index.php" method="post">
401 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
402 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
403 echo " <input type=\"hidden\" name=\"passwd\" value=\"set\" />\n";
406 <legend>Password recovery</legend>
409 <td><label for="email">Old password:</label></td>
410 <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
412 <td><label for="password">New password:</label></td>
413 <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
415 <td><label for="password">Retype:</label></td>
416 <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
419 <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>