3 /* functions which only ouput html */
5 function display_status($gametype)
7 echo "<div class=\"info\">";
8 echo " Gametype: $gametype";
14 function display_news()
17 echo "<div class=\"bug\">\n".
18 " Please hit <strong>shift+reload</strong>.<br /><hr />\n".
19 " The server now keeps score... (only from now on) <br /><hr />".
20 " If you find more bugs, please list them in the <a href=\"".
21 $wiki."\">wiki</a>.\n</div>\n";
25 function output_link_to_user_page($email,$password)
27 echo "<div class=\"over\">\n";
28 echo "<form action=\"index.php\" method=\"post\">\n";
29 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
30 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
31 echo " <input type=\"submit\" value=\"go to my user page\" />\n";
38 function output_register()
40 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 />";
41 echo "TODO: convert timezone into a menu<br />\n";
42 echo "TODO: figure out a way to handle passwords <br />\n";
44 <form action="index.php" method="post">
46 <legend>Register</legend>
49 <td><label for="Rfullname">Full name:</label></td>
50 <td><input type="text" id="Rfullname" name="Rfullname" size="20" maxsize="30" /> </td>
52 <td><label for="Remail">Email:</label></td>
53 <td><input type="text" id="Remail" name="Remail" size="20" maxsize="30" /></td>
55 <td><label for="Rpassword">Password(will be displayed in cleartext on the next page):</label></td>
56 <td><input type="password" id="Rpassword" name="Rpassword" size="20" maxsize="30" /></td>
58 <td><label for="Rtimezone">Timezone:</label></td>
60 <input type="text" id="Rtimezone" name="Rtimezone" size="4" maxsize="4" value="+1" />
63 <td colspan="2"> <input type="submit" value="register" /></td>
71 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
75 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
76 echo "<form action=\"index.php\" method=\"post\">\n";
77 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
78 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
79 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
80 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
81 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
82 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
83 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
84 echo " <input type=\"submit\" value=\"keep playing\" />\n";
90 function output_form_for_new_game($names)
94 <p>Please select four players (or use the randomly pre-selected names)</p>
95 <form action="index.php" method="post">
97 /* ask for player names */
98 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
100 srand((float) microtime() * 10000000);
101 $randkey = array_rand($names);
102 $rand = $names[$randkey];
103 echo " Name: <select name=\"$player\" size=\"1\" /> \n";
104 foreach($names as $name)
108 echo " <option selected=\"selected\">$name</option>\n";
111 echo " <option>$name</option>\n";
117 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
120 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
121 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
122 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
125 <p> schweinchen (both foxes), only in normal games or silent solos:
127 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
128 <li> <input type="radio" name="schweinchen" value="both" />
129 both become highest trump (automatic call at beginning of the game)
131 <li> <input type="radio" name="schweinchen" value="second" />
132 first one normal, second one becomes highest (call during the game) </li>
133 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
134 second one become highest only in case re/contra was announced (not working yet)
139 <input type="submit" value="start game" />
144 function display_card($card)
146 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
147 * convert even cards to the matching odd value */
149 if( $card/2 - (int)($card/2) == 0.5)
150 echo "<img src=\"cards/".$card.".png\" alt=\"".card_to_name($card)."\" />\n";
152 echo "<img src=\"cards/".($card-1).".png\" alt=\"".card_to_name($card-1)."\" />\n";
157 function display_link_card($card)
159 if( $card/2 - (int)($card/2) == 0.5)
160 echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".$card.".png\" alt=\"\" />\n";
162 echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".($card-1).".png\" alt=\"\" />\n";
166 function check_for_sickness($me,$mycards)
169 <p> Solo will work, but the first player will not change. Nothing else implemented. </p>
171 <form action="index.php" method="post">
173 do you want to play solo?
174 <select name="solo" size="1">
175 <option selected="selected">No</option>
176 <option>trumpless</option>
177 <option>trump</option>
178 <option>queen</option>
179 <option>jack</option>
180 <option>club</option>
181 <option>spade</option>
182 <option>heart</option>
189 if(check_wedding($mycards))
191 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
192 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
196 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
199 echo "do you have poverty?";
200 if(count_trump($mycards)<4)
202 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
203 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
207 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
210 echo "do you have too many nines?";
211 if(count_nines($mycards)>4)
213 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
214 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
218 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
221 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
222 echo "<input type=\"submit\" value=\"count me in\" />\n";
229 function check_want_to_play($me)
232 <form action="index.php" method="post">
233 Do you want to play a game of DoKo?
234 yes<input type="radio" name="in" value="yes" />
235 no<input type="radio" name="in" value="no" /> <br />
239 Do you want to get an email for every card played or only if it your move?
240 every card<input type="radio" name="update" value="card" />
241 only on my turn<input type="radio" name="update" value="turn" /> <br />
243 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
245 echo "<input type=\"submit\" value=\"count me in\" />\n";
251 function output_home_page()
254 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
255 <p> Please <a href="index.php?register">register</a>, in case you haven't done yet <br />
256 or login with you email-address or name and password here:
258 <form action="index.php" method="post">
260 <legend>Login</legend>
263 <td><label for="email">Email:</label></td><td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
265 <td><label for="password">Password:</label></td><td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
267 <td> <input type="submit" value="login" /></td>
276 function output_header()
280 <!DOCTYPE html PUBLIC
281 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
282 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
283 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
285 <title>e-Doko</title>
286 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
287 <link rel="stylesheet" type="text/css" href="css/standard.css" />
288 <script type="text/javascript">
290 if(document.getElementById){
293 if(document.getElementById("trick"+i))
294 document.getElementById("trick"+i).style.display = 'none';
296 document.getElementById("trick"+num).style.display = 'block';
299 function high_last(){
300 if(document.getElementById){
303 if(document.getElementById("trick"+i))
313 <body onload="high_last();">
315 <h1> Welcome to E-Doko </h1>
316 <p> Revision: <?php echo "$REV"; ?></p>
325 function output_footer()