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 passwrods <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";
114 unset($names[$randkey]);
121 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
122 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
123 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
126 <p> schweinchen (both foxes):
128 <li> <input type="radio" name="schweinchen" value="none" /> none </li>
129 <li> <input type="radio" name="schweinchen" value="both" /> both become highest trump (call at beginning of the game)(doesn't work yet) </li>
130 <li> <input type="radio" name="schweinchen" value="second" checked="checked" /> first one normal, second one becomes highest (call during the game) (doesn't work yet) </li>
131 <li> <input type="radio" name="schweinchen" value="secondaftercall" /> second one become highest only in case re/contra was announced (doesn't work yet)</li>
135 <input type="submit" value="start game" />
140 function display_card($card)
142 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
143 * convert even cards to the matching odd value */
145 if( $card/2 - (int)($card/2) == 0.5)
146 echo "<img src=\"cards/".$card.".png\" alt=\"".card_to_name($card)."\" />\n";
148 echo "<img src=\"cards/".($card-1).".png\" alt=\"".card_to_name($card-1)."\" />\n";
153 function display_link_card($card)
155 if( $card/2 - (int)($card/2) == 0.5)
156 echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".$card.".png\" alt=\"\" />\n";
158 echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".($card-1).".png\" alt=\"\" />\n";
162 function check_for_sickness($me,$mycards)
165 <p> Solo will work, but the first player will not change. Nothing else implemented. </p>
167 <form action="index.php" method="post">
169 do you want to play solo?
170 <select name="solo" size="1">
171 <option selected="selected">No</option>
172 <option>trumpless</option>
173 <option>trump</option>
174 <option>queen</option>
175 <option>jack</option>
176 <option>club</option>
177 <option>spade</option>
178 <option>heart</option>
185 if(check_wedding($mycards))
187 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
188 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
192 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
195 echo "do you have poverty?";
196 if(count_trump($mycards)<4)
198 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
199 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
203 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
206 echo "do you have too many nines?";
207 if(count_nines($mycards)>4)
209 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
210 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
214 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
217 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
218 echo "<input type=\"submit\" value=\"count me in\" />\n";
225 function check_want_to_play($me)
228 <form action="index.php" method="post">
229 Do you want to play a game of DoKo?
230 yes<input type="radio" name="in" value="yes" />
231 no<input type="radio" name="in" value="no" /> <br />
235 Do you want to get an email for every card played or only if it your move?
236 every card<input type="radio" name="update" value="card" />
237 only on my turn<input type="radio" name="update" value="turn" /> <br />
239 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
241 echo "<input type=\"submit\" value=\"count me in\" />\n";
247 function output_home_page()
250 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
251 <p> Please <a href="index.php?register">register</a>, in case you haven't done yet <br />
252 or login with you email-address or name and password here:
254 <form action="index.php" method="post">
256 <legend>Login</legend>
259 <td><label for="email">Email:</label></td><td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
261 <td><label for="password">Password:</label></td><td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
263 <td> <input type="submit" value="login" /></td>
272 function output_header()
276 <!DOCTYPE html PUBLIC
277 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
278 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
279 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
281 <title>e-Doko</title>
282 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
283 <link rel="stylesheet" type="text/css" href="css/standard.css" />
284 <script type="text/javascript">
286 if(document.getElementById){
289 if(document.getElementById("trick"+i))
290 document.getElementById("trick"+i).style.display = 'none';
292 document.getElementById("trick"+num).style.display = 'block';
295 function high_last(){
296 if(document.getElementById){
299 if(document.getElementById("trick"+i))
309 <body onload="high_last();">
311 <h1> Welcome to E-Doko </h1>
312 <p> Revision: <?php echo "$REV"; ?></p>
321 function output_footer()