If you find bugs, please list them in the wiki
\n"; echo "Cards that have a green background have a comment, which you can access by hovering over the card with your mouse ;)
\n"; $history=array(); /* check for status file and read it, if possible */ if(file_exists("status.txt")) $lines = file("status.txt"); else die("no file"); /* check if we want to start a new game */ if( isset($_REQUEST["PlayerA"]) && isset($_REQUEST["PlayerB"]) && isset($_REQUEST["PlayerC"]) && isset($_REQUEST["PlayerD"]) && isset($_REQUEST["EmailA"]) && isset($_REQUEST["EmailB"]) && isset($_REQUEST["EmailC"]) && isset($_REQUEST["EmailD"]) && sizeof($lines<2)) { $PlayerA = $_REQUEST["PlayerA"]; $PlayerB = $_REQUEST["PlayerB"]; $PlayerC = $_REQUEST["PlayerC"]; $PlayerD = $_REQUEST["PlayerD"]; $EmailA = $_REQUEST["EmailA"] ; $EmailB = $_REQUEST["EmailB"] ; $EmailC = $_REQUEST["EmailC"] ; $EmailD = $_REQUEST["EmailD"] ; $hashA = md5("AGameOfDoko".$PlayerA.$EmailA); $hashB = md5("AGameOfDoko".$PlayerB.$EmailB); $hashC = md5("AGameOfDoko".$PlayerC.$EmailC); $hashD = md5("AGameOfDoko".$PlayerD.$EmailD); /* send out email, check for error with email */ $message = "\n". "you are invited to play a game of DoKo (that is to debug the program ;).\n". "Place comments and bug reports here:\n". "http://wiki.nubati.net/index.php?title=EmailDoko\n\n". "The whole round would consist of the following players:\n". "$PlayerA\n". "$PlayerB\n". "$PlayerC\n". "$PlayerD\n\n". "If you want to join this game, please follow this link:\n\n". " ".$host."?a="; mymail($EmailA,"Invite for a game of DoKo","Hello $PlayerA,\n".$message.$hashA); mymail($EmailB,"Invite for a game of DoKo","Hello $PlayerB,\n".$message.$hashB); mymail($EmailC,"Invite for a game of DoKo","Hello $PlayerC,\n".$message.$hashC); mymail($EmailD,"Invite for a game of DoKo","Hello $PlayerD,\n".$message.$hashD); /* read in random.txt */ if(file_exists("random.txt")) $random = file("random.txt"); else die("no random file"); $randomNR = explode( ":", $random[2] ); /* write initial status into file */ $output = fopen("status.txt","w"); if ($output) { fwrite($output, "$hashA:$PlayerA:$EmailA:::" ); for($i=0;$i<11;$i++) fwrite($output,"$randomNR[$i];" ); fwrite($output,"$randomNR[11]:" ); $i++; fwrite($output,"\n"); fwrite($output, "$hashB:$PlayerB:$EmailB:::" ); for(;$i<23;$i++) fwrite($output,"$randomNR[$i];" ); fwrite($output,"$randomNR[23]:" ); $i++; fwrite($output,"\n"); fwrite($output, "$hashC:$PlayerC:$EmailC:::" ); for(;$i<35;$i++) fwrite($output,"$randomNR[$i];" ); fwrite($output,"$randomNR[35]:" ); $i++; fwrite($output,"\n"); fwrite($output, "$hashD:$PlayerD:$EmailD:::"); for(;$i<47;$i++) fwrite($output,"$randomNR[$i];" ); fwrite($output,"$randomNR[47]:" ); fwrite($output,"\n"); fclose($output); } else echo "can't open file for writing"; }; /* test if a game is running, else output everything for a new game */ if(sizeof($lines)<2) { ?>no game in progress, please input 4 names and email addresses, please make sure that the addresses are correct!
\n"; } } /* *** * * * * *** * * * * *** * yes? email him his hand, ask for solo, poverty, email every move or every card? */ if(isset($_REQUEST["b"])) { $b=$_REQUEST["b"]; if( ereg("s",$player[$b]["option"]) && $game["init"]<4) { echo "just wait for the game to start"; } else if( (!isset($_REQUEST["in"])|| !isset($_REQUEST["update"])) && !ereg("i",$player[$b]["option"])) { echo "go back to "; echo " here and fill out the formaehm... at the moment please just answer everything with no, still need to implement this
\n"; } } } if(isset($_REQUEST["c"])) { $c=$_REQUEST["c"]; if(!isset($_REQUEST["solo"])|| !isset($_REQUEST["wedding"])|| !isset($_REQUEST["poverty"]) || !isset($_REQUEST["nines"]) ) { echo "go back to "; echo " here and fill out the form\n";
/* is it our turn? */
if($hash[$next]==$me && !isset($_REQUEST["card"]) && !isset($_REQUEST["win"]))
{
echo "ITS YOUR TURN
\n";
echo "your cards are:
\n";
foreach($mycards as $card)
{
display_link_card($card,$me);
}
}
else
{ /* not our turn, just show the hand */
echo "your cards are:
\n";
foreach($mycards as $card)
{
display_card($card);
}
}
echo "