diff options
author | Arun Persaud <arun@nubati.net> | 2007-07-29 18:54:14 -0700 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2007-07-29 18:54:14 -0700 |
commit | d8eac0035f97a64371557e7da8b9730fe28d8788 (patch) | |
tree | adf0aa43c797aa410879c4e975c8c694da554728 /index.php | |
parent | d7c42361bda4c64a0594a8640156a504fc334f11 (diff) | |
download | e-DoKo-d8eac0035f97a64371557e7da8b9730fe28d8788.tar.gz e-DoKo-d8eac0035f97a64371557e7da8b9730fe28d8788.tar.bz2 e-DoKo-d8eac0035f97a64371557e7da8b9730fe28d8788.zip |
LAYOUT: address game by session.gamenr
don't use gameid, but use session.gamenumber instead. needs this for tournaments later.
new games will get a session number now by default.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 51 |
1 files changed, 27 insertions, 24 deletions
@@ -102,9 +102,12 @@ else if(myisset("new")) DB_close(); exit(); }; + /* get max session */ + $max = DB_get_max_session(); + $max++; mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1',NULL,'pre', ". - "'$ruleset',NULL ,NULL)"); + "'$ruleset','$max' ,NULL)"); } $game_id = mysql_insert_id(); @@ -187,19 +190,19 @@ else if(myisset("cancle","me")) if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */ { $message = "Hello, \n\n". - "Game $gameid has been cancled since nothing happend for a while and $myname requested it.\n"; + "Game ".DB_format_gameid($gameid)." has been cancled since nothing happend for a while and $myname requested it.\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) { $To = DB_get_email_by_userid($user); - mymail($To,$EmailName."game $gameid cancled (timed out)",$message); + mymail($To,$EmailName."game ".DB_format_gameid($gameid)." cancled (timed out)",$message); } /* delete everything from the dB */ DB_cancel_game($me); - echo "<p style=\"background-color:red\";>Game $gameid has been cancled.<br /><br /></p>"; + echo "<p style=\"background-color:red\";>Game ".DB_format_gameid($gameid)." has been cancled.<br /><br /></p>"; } else echo "<p>You need to wait longer before you can cancle a game...</p>\n"; @@ -399,7 +402,7 @@ else if(myisset("me")) foreach($userids as $user) { $To = DB_get_email_by_userid($user); - mymail($To,$EmailName."game $gameid canceled",$message); + mymail($To,$EmailName."game ".DB_format_gameid($gameid)." canceled",$message); } /* delete everything from the dB */ @@ -513,10 +516,10 @@ else if(myisset("me")) $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); if($userhash != $me) { - $message = "Everyone finish the questionary in game $gameid, ". + $message = "Everyone finish the questionary in game ".DB_format_gameid($gameid).", ". "please visit this link now to continue: \n". " ".$host."?me=".$userhash."\n\n" ; - mymail($To,$EmailName." finished setup in game $gameid",$message); + mymail($To,$EmailName." finished setup in game ".DB_format_gameid($gameid),$message); } }; }; @@ -610,7 +613,7 @@ else if(myisset("me")) foreach($userids as $user) { $To = DB_get_email_by_userid($user); - mymail($To,$EmailName."game $gameid canceled",$message); + mymail($To,$EmailName."game ".DB_format_gameid($gameid)." canceled",$message); } /* delete everything from the dB */ @@ -786,7 +789,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 (game $gameid)",$message); + mymail($To,$EmailName." poverty (game ".DB_format_gameid($gameid).")",$message); } /* this user is done */ @@ -867,7 +870,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 (game $gameid)",$message); + mymail($To,$EmailName." poverty (game ".DB_format_gameid($gameid).")",$message); } } @@ -968,19 +971,19 @@ else if(myisset("me")) if($who==5 || $who==50) { $message = "Hello, \n\n". - "Game $gameid has been cancled since nobody wanted to take the trump.\n"; + "Game ".DB_format_gameid($gameid)." has been cancled since nobody wanted to take the trump.\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) { $To = DB_get_email_by_userid($user); - mymail($To,$EmailName."game $gameid cancled (poverty not resolved)",$message); + mymail($To,$EmailName."game ".DB_format_gameid($gameid)." cancled (poverty not resolved)",$message); } /* delete everything from the dB */ DB_cancel_game($me); - echo "<p style=\"background-color:red\";>Game $gameid has been cancled.<br /><br /></p>"; + echo "<p style=\"background-color:red\";>Game ".DB_format_gameid($gameid)." has been cancled.<br /><br /></p>"; output_footer(); DB_close(); exit(); @@ -1010,9 +1013,9 @@ else if(myisset("me")) if($hash!=$me) { /* email startplayer) */ - $message = "It's your turn now in game $gameid.\n". + $message = "It's your turn now in game ".DB_format_gameid($gameid).".\n". "Use this link to play a card: ".$host."?me=".$hash."\n\n" ; - mymail($email,$EmailName."ready, set, go... (game $gameid) ",$message); + mymail($email,$EmailName."ready, set, go... (game ".DB_format_gameid($gameid).") ",$message); } else echo " Please, <a href=\"$host?me=$me\">start</a> the game.<br />"; @@ -1099,7 +1102,7 @@ else if(myisset("me")) $firstcard = ""; /* first card in a trick */ echo "\n<ul class=\"tricks\">\n"; - echo " <li class=\"nohighlight\"> Game $gameid: </li>\n"; + echo " <li class=\"nohighlight\"> Game ".DB_format_gameid($gameid).": </li>\n"; while($r = mysql_fetch_array($result,MYSQL_NUM)) { @@ -1348,10 +1351,10 @@ else if(myisset("me")) $who = DB_get_userid_by_email($email); DB_set_player_by_gameid($gameid,$who); - $message = "A card has been played in game $gameid.\n\n". + $message = "A card has been played in game ".DB_format_gameid($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 in game $gameid",$message); + mymail($email,$EmailName."a card has been played in game ".DB_format_gameid($gameid),$message); } else /* send out final email */ { @@ -1389,15 +1392,15 @@ else if(myisset("me")) $To = implode(",",$all); $help = "\n\n (you can use reply all on this email to reach all the players.)\n"; - mymail($To,$EmailName."game over (game $gameid) part 1(2)",$message.$help); + mymail($To,$EmailName."game over (game ".DB_format_gameid($gameid).") part 1(2)",$message.$help); foreach($userids as $user) { $To = DB_get_email_by_userid($user); $hash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $link = "Use this link to have a look at game $gameid: ".$host."?me=".$hash."\n\n" ; - mymail($To,$EmailName."game over (game $gameid) part 2(2)",$link); + $link = "Use this link to have a look at game ".DB_format_gameid($gameid).": ".$host."?me=".$hash."\n\n" ; + mymail($To,$EmailName."game over (game ".DB_format_gameid($gameid).") part 2(2)",$link); } } } @@ -1714,7 +1717,7 @@ else if( myisset("email","password") || isset($_SESSION["name"]) ) " WHERE Hand.user_id='$uid' AND Game.status='pre'" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) { - echo "<a href=\"".$host."?me=".$r[0]."\">game #".$r[1]." </a>"; + echo "<a href=\"".$host."?me=".$r[0]."\">game".DB_format_gameid($r[1])." </a>"; if($r[3]==$uid || $r[3]==NULL) echo "(it's <strong>your</strong> turn)\n"; else @@ -1737,7 +1740,7 @@ else if( myisset("email","password") || isset($_SESSION["name"]) ) " WHERE Hand.user_id='$uid' AND Game.status='play'" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) { - echo "<a href=\"".$host."?me=".$r[0]."\">game #".$r[1]." </a>"; + echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>"; if($r[3]) { if($r[3]==$uid) @@ -1761,7 +1764,7 @@ else if( myisset("email","password") || isset($_SESSION["name"]) ) $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)) - $output[] = "<a href=\"".$host."?me=".$r[0]."\">#".$r[1]." </a>"; + $output[] = "<a href=\"".$host."?me=".$r[0]."\">".DB_format_gameid($r[1])." </a>"; echo implode(", ",$output)."</p>\n"; $names = DB_get_all_names(); |