X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=8e4f17f1293c03ed309c597b52629b4f08de9a7c;hp=1710bd7b9f581645aed453c034449d6c372308bd;hb=337229f87e4507dd1ea9fa80cfc981f19822b726;hpb=3bcf4379ee051e83db6bdd80b1ff04ad4b41206a diff --git a/index.php b/index.php index 1710bd7..8e4f17f 100644 --- a/index.php +++ b/index.php @@ -62,6 +62,7 @@ if(myisset("new")) { echo "couldn't find one of the names, please start a new game"; output_footer(); + DB_close(); exit(); } @@ -80,6 +81,7 @@ if(myisset("new")) { echo "Error defining ruleset: $ruleset"; output_footer(); + DB_close(); exit(); }; @@ -172,6 +174,7 @@ else if(myisset("cancle","me")) echo "Can't find you in the database, please check the url.
\n"; echo "perhaps the game has been cancled, check by login in here."; output_footer(); + DB_close(); exit(); } @@ -217,6 +220,7 @@ else if(myisset("me")) echo "Can't find you in the database, please check the url.
\n"; echo "perhaps the game has been cancled, check by login in here."; output_footer(); + DB_close(); exit(); } @@ -243,7 +247,9 @@ else if(myisset("me")) $RULES["dullen"] = $r[2]; $RULES["schweinchen"] = $r[3]; - + $RULES["call"] = "1st-own-card"; + + /* get some infos about the game */ $gametype = DB_get_gametype_by_gameid($gameid); $gamestatus = DB_get_game_status_by_gameid($gameid); @@ -333,7 +339,7 @@ else if(myisset("me")) display_card($card,$PREF["cardset"]); echo "

\n"; - check_for_sickness($me,$mycards); + output_check_for_sickness($me,$mycards); /* move on to the next stage*/ DB_set_hand_status_by_hash($me,'check'); @@ -425,7 +431,7 @@ else if(myisset("me")) $message = "Everyone finish the questionary in game $gameid, ". "please visit this link now to continue: \n". " ".$host."?me=".$userhash."\n\n" ; - mymail($To,$EmailName." finished setup",$message); + mymail($To,$EmailName." finished setup in game $gameid",$message); } }; @@ -529,6 +535,7 @@ else if(myisset("me")) echo "The game has been canceled because ".DB_get_name_by_userid($nines). " has five or more nines and nobody is playing solo.\n"; output_footer(); + DB_close(); exit(); } else if($poverty==1) @@ -694,7 +701,7 @@ else if(myisset("me")) $message = "Someone has poverty, it's your turn to decide, if you want to take the trump. Please visit:". " ".$host."?me=".$userhash."\n\n" ; - mymail($To,$EmailName." poverty",$message); + mymail($To,$EmailName." poverty (game $gameid)",$message); } /* this user is done */ @@ -774,7 +781,7 @@ else if(myisset("me")) $message = "Someone has poverty, it's your turn to decide, ". "if you want to take the trump. Please visit:". " ".$host."?me=".$userhash."\n\n" ; - mymail($To,$EmailName." poverty",$message); + mymail($To,$EmailName." poverty (game $gameid)",$message); } } @@ -898,6 +905,7 @@ else if(myisset("me")) echo "

Game $gameid has been cancled.

"; output_footer(); + DB_close(); exit(); } @@ -922,7 +930,7 @@ else if(myisset("me")) /* email startplayer) */ $message = "It's your turn now in game $gameid.\n". "Use this link to play a card: ".$host."?me=".$hash."\n\n" ; - mymail($email,$EmailName."ready, set, go... ",$message); + mymail($email,$EmailName."ready, set, go... (game $gameid) ",$message); } else echo " Please, start the game.
"; @@ -1057,7 +1065,7 @@ else if(myisset("me")) else echo "(wedding)"; - if(subst_compare($GT,"solo",0,4) && $party=="re") + if(ereg("solo",$GT) && $party=="re") echo "($GT)"; /* add point calls */ @@ -1065,8 +1073,8 @@ else if(myisset("me")) echo " $party $call "; echo "
\n"; - echo " local time: ".date("Y-m-d H:i:s")."\n"; - echo " last login: ".date("Y-m-d H:i:s",$unixtime)."
\n"; + echo " local time: ".date("Y-m-d H:i:s")."
\n"; + echo " last login: ".date("Y-m-d H:i:s",$lastlogin)."
\n"; echo " \n"; } @@ -1411,7 +1419,7 @@ else if(myisset("me")) $message = "A card has been played in game $gameid.\n\n". "It's your turn now.\n". "Use this link to play a card: ".$host."?me=".$next_hash."\n\n" ; - mymail($email,$EmailName."a card has been played",$message); + mymail($email,$EmailName."a card has been played in game $gameid",$message); } } else @@ -1461,7 +1469,9 @@ else if(myisset("me")) " "; if( can_call(0,$me) ) echo " 0:". - " "; + " ". + " no call:". + " "; echo "
\nA short comments:\n"; echo "\n"; @@ -1535,6 +1545,7 @@ else if(myisset("me")) echo "error in testing the status"; } output_footer(); + DB_close(); exit(); } /* user status page */ @@ -1663,15 +1674,15 @@ else if(myisset("me")) echo "

and these are your games that are already done:
Game: \n"; + $output=array(); $result = mysql_query("SELECT hash,game_id from Hand WHERE user_id='$uid' AND status='gameover'" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) - echo "#".$r[1]." , "; - echo "

\n"; + $output[]= "#".$r[1]." "; + echo implode(", ",$output)."

\n"; $names = DB_get_all_names(); echo "

registered players:
\n"; - foreach ($names as $name) - echo "$name, \n"; + echo implode(", ",$names)."\n"; echo "

\n"; echo "

Want to start a new game? Visit this page.

"; @@ -1683,6 +1694,7 @@ else if(myisset("me")) } }; output_footer(); + DB_close(); exit(); } /* page for registration */ @@ -1727,7 +1739,14 @@ else if(myisset("me")) $game = mysql_fetch_array($r,MYSQL_NUM); $done = mysql_fetch_array($r,MYSQL_NUM); } - output_home_page($pre[0],$game[0],$done[0]); + + $r=mysql_query("SELECT AVG(datediff(mod_date,create_date)) FROM Game where status='gameover' "); + if($r) + $avgage= mysql_fetch_array($r,MYSQL_NUM); + else + $avgage[0]=0; + + output_home_page($pre[0],$game[0],$done[0],$avgage[0]); } output_footer();