$game_id = mysql_insert_id();
/* create hash */
- $hashA = md5("AGameOfDoko".$game_id.$PlayerA.$EmailA);
- $hashB = md5("AGameOfDoko".$game_id.$PlayerB.$EmailB);
- $hashC = md5("AGameOfDoko".$game_id.$PlayerC.$EmailC);
- $hashD = md5("AGameOfDoko".$game_id.$PlayerD.$EmailD);
+ $TIME = (string) time(); /* to avoid collisions */
+ $hashA = md5("AGameOfDoko".$game_id.$PlayerA.$EmailA.$TIME);
+ $hashB = md5("AGameOfDoko".$game_id.$PlayerB.$EmailB.$TIME);
+ $hashC = md5("AGameOfDoko".$game_id.$PlayerC.$EmailC.$TIME);
+ $hashD = md5("AGameOfDoko".$game_id.$PlayerD.$EmailD.$TIME);
/* create hands */
mysql_query("INSERT INTO Hand VALUES (NULL,".DB_quote_smart($game_id).",".DB_quote_smart($useridA).
*/
if( !myisset("in") )
{
- echo "you need to answer the <a href=\"$host?me=$me\">question</a>.";
+ echo "<p> you need to answer the <a href=\"$host?me=$me\">question</a>.</p>";
DB_set_hand_status_by_hash($me,'start');
}
else
{
/* user doesn't want to take trump */
/* set next player who needs to be asked */
- $firstsick = DB_get_sickness_by_pos_and_gameid($mypos+1,$gameid);
- $secondsick = DB_get_sickness_by_pos_and_gameid($mypos+2,$gameid);
- if($firstsick!="poverty")
- DB_set_sickness_by_gameid($gameid,$who+$add);
- else
+ $firstsick = (string) DB_get_sickness_by_pos_and_gameid($mypos+1,$gameid);
+ $secondsick = (string) DB_get_sickness_by_pos_and_gameid($mypos+2,$gameid);
+
+ if($firstsick=="poverty")
{
- if($secondsick!="poverty")
- DB_set_sickness_by_gameid($gameid,$who+$add*2);
- else
+ if($secondsick=="poverty")
DB_set_sickness_by_gameid($gameid,$who+$add*3);
- };
+ else
+ DB_set_sickness_by_gameid($gameid,$who+$add*2);
+ }
+ else
+ DB_set_sickness_by_gameid($gameid,$who+$add);
/* this user is done */
DB_set_hand_status_by_hash($me,'play');
$exchange = $_REQUEST["exchange"];
$userhand = DB_get_handid_by_gameid_and_userid($gameid,$trump);
- echo "you give $exchange to your partner";
-
/* if exchange is set to a value>0, exchange that card back to user $trump */
if($exchange >0)
{
/* mark card as played */
mysql_query("UPDATE Hand_Card SET played='true' WHERE hand_id='$handid' AND card_id=".
DB_quote_smart($card));
+
/* update Game timestamp */
DB_update_game_timestamp($gameid);
{
echo "Hello ".$myname.", it's your turn! <br />\n";
echo "Your cards are: <br />\n";
- echo "<form action=\"index.php?me=$me\" method=\"post\">\n";
+ echo "<form action=\"index.php?me=$me\" method=\"post\">\n";
/* do we have to follow suite? */
$followsuit = 0;