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 "<div class=\"over\">\n";
18 echo "<form action=\"index.php\" method=\"post\">\n";
19 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
20 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
21 echo " <input type=\"submit\" value=\"go to my user page\" />\n";
28 function output_register()
30 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 />";
31 echo "TODO: convert timezone into a menu<br />\n";
32 echo "TODO: figure out a way to handle passwords <br />\n";
34 <form action="index.php" method="post">
36 <legend>Register</legend>
39 <td><label for="Rfullname">Full name:</label></td>
40 <td><input type="text" id="Rfullname" name="Rfullname" size="20" maxsize="30" /> </td>
42 <td><label for="Remail">Email:</label></td>
43 <td><input type="text" id="Remail" name="Remail" size="20" maxsize="30" /></td>
45 <td><label for="Rpassword">Password(will be displayed in cleartext on the next page):</label></td>
46 <td><input type="password" id="Rpassword" name="Rpassword" size="20" maxsize="30" /></td>
48 <td><label for="Rtimezone">Timezone:</label></td>
50 <input type="text" id="Rtimezone" name="Rtimezone" size="4" maxsize="4" value="+1" />
53 <td colspan="2"> <input type="submit" value="register" /></td>
61 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
65 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
66 echo "<form action=\"index.php\" method=\"post\">\n";
67 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
68 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
69 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
70 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
71 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
72 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
73 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
74 echo " <input type=\"submit\" value=\"keep playing\" />\n";
80 function output_form_for_new_game($names)
84 <p>Please select four players (or use the randomly pre-selected names)</p>
85 <form action="index.php" method="post">
87 /* ask for player names */
88 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
90 srand((float) microtime() * 10000000);
91 $randkey = array_rand($names);
92 $rand = $names[$randkey];
93 echo " Name: <select name=\"$player\" size=\"1\" /> \n";
94 foreach($names as $name)
98 echo " <option selected=\"selected\">$name</option>\n";
101 echo " <option>$name</option>\n";
107 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
110 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
111 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
112 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
115 <p> schweinchen (both foxes), only in normal games or silent solos:
117 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
118 <li> <input type="radio" name="schweinchen" value="both" />
119 both become highest trump (automatic call at beginning of the game)
121 <li> <input type="radio" name="schweinchen" value="second" />
122 first one normal, second one becomes highest (call during the game) </li>
123 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
124 second one become highest only in case re/contra was announced (not working yet)
129 <input type="submit" value="start game" />
134 function display_card($card,$dir="english")
136 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
137 * convert even cards to the matching odd value */
139 if( $card/2 - (int)($card/2) == 0.5)
140 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".card_to_name($card)."\" />\n";
142 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".card_to_name($card-1)."\" />\n";
147 function display_link_card($card,$dir="english")
149 if( $card/2 - (int)($card/2) == 0.5)
150 echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".$dir."/".$card.".png\" alt=\"\" />\n";
152 echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"\" />\n";
156 function check_for_sickness($me,$mycards)
159 <p> Solo will work, but the first player will not change. Nothing else implemented. </p>
161 <form action="index.php" method="post">
163 do you want to play solo?
164 <select name="solo" size="1">
165 <option selected="selected">No</option>
166 <option>trumpless</option>
167 <option>trump</option>
168 <option>queen</option>
169 <option>jack</option>
170 <option>club</option>
171 <option>spade</option>
172 <option>heart</option>
179 if(check_wedding($mycards))
181 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
182 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
186 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
189 echo "do you have poverty?";
190 if(count_trump($mycards)<4)
192 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
193 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
197 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
200 echo "do you have too many nines?";
201 if(count_nines($mycards)>4)
203 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
204 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
208 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
211 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
212 echo "<input type=\"submit\" value=\"count me in\" />\n";
219 function check_want_to_play($me)
222 <form action="index.php" method="post">
223 Do you want to play a game of DoKo?
224 yes<input type="radio" name="in" value="yes" />
225 no<input type="radio" name="in" value="no" /> <br />
229 Do you want to get an email for every card played or only if it your move?
230 every card<input type="radio" name="update" value="card" />
231 only on my turn<input type="radio" name="update" value="turn" /> <br />
233 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
235 echo "<input type=\"submit\" value=\"count me in\" />\n";
241 function output_home_page($pre,$game,$done)
244 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
245 <p> At the moment there are <?php echo "$pre";?> games that are being started and <?php echo"$game"; ?> games that are ongoing.
246 <?php echo"$done";?> games have been completed on this server. </p>
247 <p> Please <a href="index.php?register">register</a>, in case you haven't done that yet <br />
248 or login with you email-address or name and password here:
250 <form action="index.php" method="post">
252 <legend>Login</legend>
255 <td><label for="email">Email:</label></td>
256 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
258 <td><label for="password">Password:</label></td>
259 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
261 <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>
320 function output_footer()
324 echo "<div class=\"footer\">\n";
325 echo "<p class=\"left\"> copyright 2006-2007 Arun Persaud</p>\n";
326 echo "<p class=\"right\"> Revision: $REV; <a href=\"http://svn.nubati.net/emaildoko/trunk/\">http://svn.nubati.net/emaildoko/trunk/</a></p> \n";