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 "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
40 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
41 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
42 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
43 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
44 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
45 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
46 echo " <input type=\"hidden\" name=\"callrule\" value=\"".$RULES["call"]."\" />\n";
47 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
48 echo " <input type=\"submit\" value=\"keep playing\" />\n";
53 function output_form_for_new_game($names)
57 <p>Please select four players (or use the randomly pre-selected names)</p>
58 <p>Remember: you need to be one of the players ;) </p>
59 <form action="index.php?action=new" method="post">
62 <img src="pics/table.png" alt="table" />
64 /* ask for player names */
66 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
68 srand((float) microtime() * 10000000);
69 $randkey = array_rand($names);
70 $rand = $names[$randkey];
71 echo "<div class=\"table".$i."\">\n";
73 echo " Name: \n <select name=\"$player\" size=\"1\" /> \n";
74 foreach($names as $name)
78 echo " <option selected=\"selected\">$name</option>\n";
81 echo " <option>$name</option>\n";
83 echo " </select>\n</div>\n";
87 <h2 class="rules"> Rules </h2>
88 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
91 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
92 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
93 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
96 <p> Schweinchen (both foxes), only in normal games or silent solos:
98 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
99 <li> <input type="radio" name="schweinchen" value="both" />
100 both become highest trump (automatic call at beginning of the game)
102 <li> <input type="radio" name="schweinchen" value="second" />
103 first one normal, second one becomes highest (call during the game) </li>
104 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
105 second one become highest only in case re/contra was announced (not working yet)
109 <p> Call Re/Contra, etc.:
111 <li><input type="radio" name="callrule" value="1st-own-card" checked="checked" />
112 Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
113 <li><input type="radio" name="callrule" value="5th-card" />
114 Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
115 <li><input type="radio" name="callrule" value="9-cards" />
116 Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
119 <input type="submit" value="start game" />
124 function display_card($card,$dir="english")
126 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
127 * convert even cards to the matching odd value */
129 if( $card/2 - (int)($card/2) == 0.5)
130 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" />\n";
132 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" />\n";
137 function display_link_card($card,$dir="english",$type="card")
139 if( $card/2 - (int)($card/2) == 0.5)
140 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";
142 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";
146 function output_check_for_sickness($me,$mycards)
149 <div class="sickness"> Thanks for joining the game...<br />
151 do you want to play solo?
152 <select name="solo" size="1">
153 <option selected="selected">No</option>
154 <option>trumpless</option>
155 <option>trump</option>
156 <option>queen</option>
157 <option>jack</option>
158 <option>club</option>
159 <option>spade</option>
160 <option>heart</option>
167 if(check_wedding($mycards))
169 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
170 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
174 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
177 echo "Do you have poverty?";
178 if(count_trump($mycards)<4)
180 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
181 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
185 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
188 echo "Do you have too many nines?";
189 if(count_nines($mycards)>4)
191 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
192 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
196 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
199 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
200 echo "<input type=\"submit\" value=\"count me in\" />\n";
207 function output_form_calls($me)
209 if( can_call(120,$me) )
210 echo " re/contra (120):".
211 " <input type=\"radio\" name=\"call\" value=\"120\" /> <br />";
212 if( can_call(90,$me) )
214 " <input type=\"radio\" name=\"call\" value=\"90\" /> <br />";
215 if( can_call(60,$me) )
217 " <input type=\"radio\" name=\"call\" value=\"60\" /> <br />";
218 if( can_call(30,$me) )
220 " <input type=\"radio\" name=\"call\" value=\"30\" /> <br />";
221 if( can_call(0,$me) )
223 " <input type=\"radio\" name=\"call\" value=\"0\" /> <br />".
225 " <input type=\"radio\" name=\"call\" value=\"no\" /> <br />";
229 function output_check_want_to_play($me)
232 <div class="joingame">
233 Do you want to play a game of DoKo? <br />
234 yes<input type="radio" name="in" value="yes" />
235 no<input type="radio" name="in" value="no" /> <br />
237 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
239 echo "<input type=\"submit\" value=\"submit\" />\n";
245 function output_home_page($pre,$game,$done,$avgtime)
249 echo"<p> If you want to play a game of Doppelkopf, you found the right place ;)".
250 " For more information please visit our <a href=\"$WIKI\">wiki</a>. </p>";
253 echo "<p> At the moment there are no games that are being started ";
255 echo "<p> At the moment there is one games that is being started ";
257 echo "<p> At the moment there are $pre games that are being started ";
262 echo "zero games that are ongoing. ";
264 echo "one game that is ongoing. ";
266 echo "$game games that are ongoing. ";
271 echo "No game has been completed on this server. </p>";
273 echo "One game has been completed on this server. </p>";
275 echo "$done games have been completed on this server. Average time of a game: $avgtime days</p>";
278 <p> Please <a href="index.php?action=register">register</a>, in case you have not done that yet <br />
279 or login with you email-address or name and password here:
281 <form action="index.php?action=login" method="post">
283 <legend>Login</legend>
286 <td><label for="email">Email:</label></td>
287 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
289 <td><label for="password">Password:</label></td>
290 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
292 <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
293 <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
303 function output_header()
307 <!DOCTYPE html PUBLIC
308 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
309 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
310 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
312 <title>e-Doko</title>
313 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
314 <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
315 <link rel="stylesheet" type="text/css" href="css/standard.css" />
316 <script type="text/javascript">
318 if(document.getElementById){
321 if(document.getElementById("trick"+i))
322 document.getElementById("trick"+i).style.display = 'none';
324 document.getElementById("trick"+num).style.display = 'block';
327 function high_last(){
328 if(document.getElementById){
331 if(document.getElementById("trick"+i))
341 <body onload="high_last();">
343 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
347 echo "<div class=\"main\">";
351 function output_footer()
356 echo "<div class=\"footer\">\n";
357 echo " <p class=\"left\"> copyright 2006-2008 Arun Persaud, Lance Thornton <br />\n".
358 " Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n".
359 " - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n".
360 " a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
361 echo " <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
362 " via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
363 " <a href=\"http://www.dreamhost.com/green.cgi\">\n".
364 " <img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
365 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>\n".
376 function output_status()
378 global $defaulttimezone;
379 if(isset($_SESSION["name"]))
381 $name = $_SESSION["name"];
384 echo "\n<div class=\"status\">";
386 echo " <a href=\"index.php?action=logout\">logout</a>";
389 /* last logon time */
390 $myid = DB_get_userid("name",$name);
391 $zone = DB_get_user_timezone($myid);
393 $time = DB_get_user_timestamp($myid);
394 date_default_timezone_set($defaulttimezone);
395 $unixtime = strtotime($time);
396 date_default_timezone_set($zone);
398 echo "<div class=\"lastlogin\">last login: ".date("r",$unixtime)."</div>\n";
404 function output_password_recovery($email,$password)
407 <form action="index.php" method="post">
409 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
410 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
411 echo " <input type=\"hidden\" name=\"passwd\" value=\"set\" />\n";
414 <legend>Password recovery</legend>
417 <td><label for="email">Old password:</label></td>
418 <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
420 <td><label for="password">New password:</label></td>
421 <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
423 <td><label for="password">Retype:</label></td>
424 <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
427 <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>