+ else if(isset($_REQUEST["comment"]))
+ { /*save comment */
+ $comment = $_REQUEST["comment"];
+ $tmp = explode(":",$history[sizeof($history)-1]); /*last played trick */
+ $tmp2 = explode("->",$tmp[sizeof($tmp)-2]); /*last played card */
+
+ $comment = str_replace(":","",$comment); /*can't have ":" in comments */
+
+ if(sizeof($tmp2)<=2)
+ $tmp[sizeof($tmp)-2] .= "->".$comment;
+ $history[sizeof($history)-1]=join(":",$tmp);
+
+ save_status();
+ }
+ else if(isset($_REQUEST["win"]) && substr_count($history[sizeof($history)-1],":")==4)
+ { /* count points, email winner */
+ $win = $_REQUEST["win"];
+
+ if(strlen($player[$hash[0]]["cards"]))
+ $history[] = $win.":\n";
+
+ /* email the player who needs to move next*/
+ for($i=0;$i<4;$i++)
+ {
+ if((ereg("c",$player[$hash[$i]]["option"]) || $i==$win) )
+ {
+ $message = " Hello ".$player[$hash[$i]]["name"].",\n\n";
+
+ if($i == $win)
+ {
+ $message .= "You won the last trick,it's your turn now.\n".
+ "Use this link to play a card: ".$host."?me=".$hash[$i]."\n\n" ;
+ }
+ else
+ $message .= $player[$hash[$win]]["name"]." has won the last trick\n".
+ "Use this link to look at the game: ".$host."?me=".$hash[$i]."\n\n" ;
+
+ if($game["solo-who"]>=0)
+ $message.= $player[$hash[$game["solo-who"]]]["name"]." is playing a ".
+ $game["solo-what"]." solo!\n";
+
+ mymail($player[$hash[$i]]["email"],"[DoKo-debug] a card has been played",$message);
+
+ if($debug)
+ echo "<a href=\"index.php?me=".$hash[$win]."\"> next player </a> <br />\n";
+ }
+ }
+