2 /* make sure that we are not called from outside the scripts,
3 * use a variable defined in config.php to check this
8 /* functions which only ouput html */
10 function output_user_settings()
14 echo "<div class=\"useroptions\">\n";
15 echo "<h4> Settings </h4>\n";
16 echo "<a href=\"index.php?passwd=ask\">Change password</a><br />";
18 echo "<h5> Card set </h5>\n";
19 if( $PREF["cardset"] == "english" )
20 echo "<a href=\"index.php?setpref=germancards\">Change to German cards</a><br />";
22 echo "<a href=\"index.php?setpref=englishcards\">Change to English cards</a> <br />";
24 echo "<h5> Email </h5>\n";
25 if( $PREF["email"] == "emailaddict" )
26 echo "<a href=\"index.php?setpref=emailnonaddict\">Change to non-addicted mode (emails for each move)</a><br />";
28 echo "<a href=\"index.php?setpref=emailaddict\">Change to addicted mode (minimal amount of emails)</a> <br />";
35 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
39 echo "<div class=\"message\">\n<form action=\"index.php?action=new\" method=\"post\">\n";
40 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
41 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
42 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
43 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
44 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
45 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
46 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
47 echo " <input type=\"hidden\" name=\"callrule\" value=\"".$RULES["call"]."\" />\n";
48 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
49 echo " <input type=\"submit\" value=\"keep playing\" />\n";
50 echo "</form>\n</div>";
54 function output_form_for_new_game($names)
58 <p>Please select four players (or use the randomly pre-selected names)</p>
59 <p>Remember: you need to be one of the players ;) </p>
60 <form action="index.php?action=new" method="post">
63 <img src="pics/table.png" alt="table" />
65 /* ask for player names */
67 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
69 srand((float) microtime() * 10000000);
70 $randkey = array_rand($names);
71 $rand = $names[$randkey];
72 echo "<div class=\"table".$i."\">\n";
74 echo " Name: \n <select name=\"$player\" size=\"1\" /> \n";
75 foreach($names as $name)
79 echo " <option selected=\"selected\">$name</option>\n";
82 echo " <option>$name</option>\n";
84 echo " </select>\n</div>\n";
88 <h2 class="rules"> Rules </h2>
89 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
92 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
93 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
94 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
97 <p> Schweinchen (both foxes), only in normal games or silent solos:
99 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
100 <li> <input type="radio" name="schweinchen" value="both" />
101 both become highest trump (automatic call at beginning of the game)
103 <li> <input type="radio" name="schweinchen" value="second" />
104 first one normal, second one becomes highest (call during the game) </li>
105 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
106 second one become highest only in case re/contra was announced (not working yet)
110 <p> Call Re/Contra, etc.:
112 <li><input type="radio" name="callrule" value="1st-own-card" checked="checked" />
113 Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
114 <li><input type="radio" name="callrule" value="5th-card" />
115 Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
116 <li><input type="radio" name="callrule" value="9-cards" />
117 Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
120 <input type="submit" value="start game" />
125 function display_card($card,$dir="english")
127 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
128 * convert even cards to the matching odd value */
130 if( $card/2 - (int)($card/2) == 0.5)
131 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" />\n";
133 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" />\n";
138 function display_link_card($card,$dir="english",$type="card")
140 if( $card/2 - (int)($card/2) == 0.5)
141 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";
143 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";
147 function output_check_for_sickness($me,$mycards)
150 <div class="sickness"> Thanks for joining the game...<br />
152 do you want to play solo?
153 <select name="solo" size="1">
154 <option selected="selected">No</option>
155 <option>trumpless</option>
156 <option>trump</option>
157 <option>queen</option>
158 <option>jack</option>
159 <option>club</option>
160 <option>spade</option>
161 <option>heart</option>
168 if(check_wedding($mycards))
170 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
171 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
175 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
178 echo "Do you have poverty?";
179 if(count_trump($mycards)<4)
181 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
182 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
186 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
189 echo "Do you have too many nines?";
190 if(count_nines($mycards)>4)
192 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
193 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
197 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
200 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
201 echo "<input type=\"submit\" value=\"count me in\" />\n";
208 function output_form_calls($me)
210 if( can_call(120,$me) )
211 echo " re/contra (120):".
212 " <input type=\"radio\" name=\"call\" value=\"120\" /> <br />";
213 if( can_call(90,$me) )
215 " <input type=\"radio\" name=\"call\" value=\"90\" /> <br />";
216 if( can_call(60,$me) )
218 " <input type=\"radio\" name=\"call\" value=\"60\" /> <br />";
219 if( can_call(30,$me) )
221 " <input type=\"radio\" name=\"call\" value=\"30\" /> <br />";
222 if( can_call(0,$me) )
224 " <input type=\"radio\" name=\"call\" value=\"0\" /> <br />".
226 " <input type=\"radio\" name=\"call\" value=\"no\" /> <br />";
230 function output_check_want_to_play($me)
233 <div class="joingame">
234 Do you want to play a game of DoKo? <br />
235 yes<input type="radio" name="in" value="yes" />
236 no<input type="radio" name="in" value="no" /> <br />
238 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
240 echo "<input type=\"submit\" value=\"submit\" />\n";
246 function output_home_page($pre,$game,$done,$avgtime)
250 echo"<p> If you want to play a game of Doppelkopf, you found the right place ;)".
251 " For more information please visit our <a href=\"$WIKI\">wiki</a>. </p>";
254 echo "<p> At the moment there are no games that are being started ";
256 echo "<p> At the moment there is one games that is being started ";
258 echo "<p> At the moment there are $pre games that are being started ";
263 echo "zero games that are ongoing. ";
265 echo "one game that is ongoing. ";
267 echo "$game games that are ongoing. ";
272 echo "No game has been completed on this server. </p>";
274 echo "One game has been completed on this server. </p>";
276 echo "$done games have been completed on this server. Average time of a game: $avgtime days</p>";
279 <p> Please <a href="index.php?action=register">register</a>, in case you have not done that yet <br />
280 or login with you email-address or name and password here:
282 <form action="index.php?action=login" method="post">
284 <legend>Login</legend>
287 <td><label for="email">Email:</label></td>
288 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
290 <td><label for="password">Password:</label></td>
291 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
293 <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
294 <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
304 function output_header()
308 <!DOCTYPE html PUBLIC
309 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
310 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
311 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
313 <title>e-Doko</title>
314 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
315 <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
316 <link rel="stylesheet" type="text/css" href="css/standard001.css" />
317 <script type="text/javascript">
319 if(document.getElementById){
322 if(document.getElementById("trick"+i))
323 document.getElementById("trick"+i).style.display = 'none';
325 document.getElementById("trick"+num).style.display = 'block';
328 function high_last(){
329 if(document.getElementById){
332 if(document.getElementById("trick"+i))
342 <body onload="high_last();">
344 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
348 echo "<div class=\"main\">";
352 function output_footer()
357 echo "<div class=\"footer\">\n";
358 echo " <p class=\"left\"> copyright 2006-2008 Arun Persaud, Lance Thornton <br />\n".
359 " Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n".
360 " - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n".
361 " a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
362 echo " <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
363 " via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
364 " <a href=\"http://www.dreamhost.com/green.cgi\">\n".
365 " <img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
366 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>\n".
377 function output_status()
379 global $defaulttimezone;
380 if(isset($_SESSION["name"]))
382 $name = $_SESSION["name"];
385 echo "\n<div class=\"status\">";
387 echo " <a href=\"index.php?action=logout\">logout</a>";
390 /* last logon time */
391 $myid = DB_get_userid("name",$name);
392 $zone = DB_get_user_timezone($myid);
394 $time = DB_get_user_timestamp($myid);
395 date_default_timezone_set($defaulttimezone);
396 $unixtime = strtotime($time);
397 date_default_timezone_set($zone);
399 echo "<div class=\"lastlogin\">last login: ".date("r",$unixtime)."</div>\n";
405 function output_password_recovery($email,$password)
408 <form action="index.php" method="post">
410 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
411 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
412 echo " <input type=\"hidden\" name=\"passwd\" value=\"set\" />\n";
415 <legend>Password recovery</legend>
418 <td><label for="email">Old password:</label></td>
419 <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
421 <td><label for="password">New password:</label></td>
422 <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
424 <td><label for="password">Retype:</label></td>
425 <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
428 <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>