echo " Gametype: $GT <br />\n";
echo "Rules: <br />\n";
- echo "10ofhearts : ".$r[2]."<br />\n";
- echo "schweinchen: ".$r[3]."<br />\n";
- echo "call: ".$r[4]."<br />\n";
+ echo "10ofhearts : ".$RULES["dullen"] ."<br />\n";
+ echo "schweinchen: ".$RULES["schweinchen"] ."<br />\n";
+ echo "call: ".$RULES["call"] ."<br />\n";
echo "</div>\n";
/* output extra division in case this game is part of a session */
switch($mystatus)
{
case 'start':
- check_want_to_play($me);
- /* move on to the next stage*/
- DB_set_hand_status_by_hash($me,'init');
- break;
+ if( !myisset("in") )
+ {
+ output_check_want_to_play($me);
+ break;
+ }
+ else
+ {
+ /* move on to the next stage*/
+ DB_set_hand_status_by_hash($me,'init');
+ }
case 'init':
/* first check if everything went ok in the last step
* if not, send user back, if yes, check what he did
*/
if( !myisset("in") )
{
- echo "<p> you need to answer the <a href=\"$host?me=$me\">question</a>.</p>";
+ echo "<p> You need to answer the <a href=\"$host?me=$me\">question</a>.</p>";
DB_set_hand_status_by_hash($me,'start');
}
else
{
if($_REQUEST["in"] == "no")
{
- /* cancle the game */
+ /* cancel the game */
$message = "Hello, \n\n".
"the game has been canceled due to the request of one of the players.\n";
}
else
{
- echo "thanks for joining the game...";
+ echo "Thanks for joining the game...";
$mycards = DB_get_hand($me);
sort($mycards);
/* ok, user is in the game, saw his cards and selected his vorbehalt
* so first we check what he selected
*/
- echo "Processing what you selected in the last step...<br />";
-
if(!myisset("solo","wedding","poverty","nines") )
{
/* all these variables have a pre-selected default,
* so we should never get here,
- * unless a user tries to cheat ;) */
- echo "something went wrong during the setup...please contact the $ADMIN_NAME at $ADMIN_EMAIL.";
+ * unless a user tries to cheat ;)
+ * can also happen if user reloads the page!
+ */
+ echo "<p> You need to answer the <a href=\"$host?me=$me&in=yes\">questions</a>.</p>";
+ DB_set_hand_status_by_hash($me,'init');
}
else
{
+ echo "Processing what you selected in the last step...<br />";
+
/* check if this sickness needs to be handled first */
$gametype = DB_get_gametype_by_gameid($gameid);
$startplayer = DB_get_startplayer_by_gameid($gameid);
* set that one in the Game table
* tell people about it.
*/
- echo "<br /> Checking if someone else selected solo, nines or wedding or poverty.<br />";
+ echo "<br /> Checking if someone else selected solo, nines, wedding or poverty.<br />";
/* check if everyone has reached this stage */
$userids = DB_get_all_userid_by_gameid($gameid);
}
else if($nines)
{
- /* cancle game */
+ /* cancel game */
/* TODO: should we keep statistics of this? */
$message = "Hello, \n\n".
- "the game has been canceled because ".DB_get_name_by_userid($nines).
- " has five or more nines and nobody is playing solo.\n";
-
- /* TODO: add info about redeal in case this is a game of a series */
+ " the game has been canceled because ".DB_get_name_by_userid($nines).
+ " has five or more nines and nobody is playing solo.\n\n".
+ " To redeal either start a new game or, in case the game was part of a tournament, \n".
+ " go to the last game and use the link at the bottom of the page to redeal.";
$userids = DB_get_all_userid_by_gameid($gameid);
foreach($userids as $user)
foreach($userids as $user)
{
/* userids are sorted by position...
- * so output whatever the firstone has, then whatever the next one has
+ * so output whatever the first one has, then whatever the next one has
* stop when the sickness is the same as the gametype
*/
if(!$session || $gameid==$r[0])
{
- /* suggest a new game with the same people in it, just rotated once */
+ /* suggest a new game with the same people in it, just rotated once (unless last game was solo) */
$names = DB_get_all_names_by_gameid($gameid);
- output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);
+ $type = DB_get_gametype_by_gameid($gameid);
+
+ if($type=="solo")
+ output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid);
+ else
+ output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);
}
}
break;
}
else /* output default user page */
{
- $time = DB_get_user_timestamp($uid);
- $unixtime =strtotime($time);
+ $time = DB_get_user_timestamp($uid);
+ $unixtime = strtotime($time);
- $offset = DB_get_user_timezone($uid);
- $zone = return_timezone($offset);
+ $offset = DB_get_user_timezone($uid);
+ $zone = return_timezone($offset);
date_default_timezone_set($zone);
/* display links to settings */
}
else
{
- echo "Sorry email and password don't match <br />";
+ echo "Sorry email and password don't match. Please <a href=\"$host\">try again</a>. <br />";
}
};
output_footer();
if($r)
echo " added you to the database";
else
- echo " something went wrong";
+ echo " something went wrong, couldn't add you to the database, please contact $ADMIN_NAME at $ADMIN_EMAIL.";
}
}
/* default login page */