summaryrefslogtreecommitdiffstats
path: root/include/game.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-10-18 11:33:36 -0700
committerArun Persaud <arun@nubati.net>2008-10-18 11:54:53 -0700
commiteb20bf1a0cae1192eb50c19220e72df8d971d8e7 (patch)
treeb056fd4e9933c733195ebf40ebbb8d5c957df5b3 /include/game.php
parent9cbbe2da9cde298ec2fbacc5029388b2a33db9f8 (diff)
downloade-DoKo-eb20bf1a0cae1192eb50c19220e72df8d971d8e7.tar.gz
e-DoKo-eb20bf1a0cae1192eb50c19220e72df8d971d8e7.tar.bz2
e-DoKo-eb20bf1a0cae1192eb50c19220e72df8d971d8e7.zip
NEW FEATURE: make it possible to view games where people played with the same hand
had to change a few things and check more often if people are logge in, so that for example personal notes only show up when you are logged in and not when someone else is looking at your cards Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/game.php')
-rw-r--r--include/game.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/include/game.php b/include/game.php
index 06d75f3..49957b1 100644
--- a/include/game.php
+++ b/include/game.php
@@ -25,7 +25,8 @@ if(!$myid)
global $GAME,$RULES,$CARDS;
/* the user has done something, update the timestamp */
-DB_update_user_timestamp($myid);
+if(isset($_SESSION['id']))
+ DB_update_user_timestamp($_SESSION['id']);
/* get some information from the DB */
$gameid = DB_get_gameid_by_hash($me);
@@ -36,7 +37,7 @@ $myhand = DB_get_handid('hash',$me);
$session = DB_get_session_by_gameid($gameid);
/* get prefs and save them in a variable*/
-$PREF = DB_get_PREF($myid);
+$PREF = DB_get_PREF(isset($_SESSION['id'])?$_SESSION['id']:$myid);
/* get rule set for this game */
$RULES = DB_get_RULES($gameid);
@@ -179,7 +180,10 @@ if($session)
$lasthash=$hash;
}
$i--;
- echo "This is game number $j of <a href=\"{$INDEX}?action=game&amp;me=$lasthash\">$i</a> in session $session.";
+ if(isset($_SESSION['id']) && $_SESSION['id']==$myid)
+ echo "This is game number $j of <a href=\"{$INDEX}?action=game&amp;me=$lasthash\">$i</a> in session $session.";
+ else
+ echo "This is game number $j of $i in session $session.";
echo "</div>\n";
}
@@ -1946,11 +1950,26 @@ if($gamestatus == 'play' || $gameend < 60*60*24*7)
echo "<input type=\"submit\" value=\"submit\" />\n";
+/* has this hand been played by others? */
+$other_game_ids = DB_played_by_others($gameid);
+if(sizeof($other_game_ids)>0 && $mystatus=='gameover')
+ {
+ $mypos = DB_get_pos_by_hash($me);
+ echo "<p>See how other played the same hand: <br />\n";
+ foreach($other_game_ids as $id)
+ {
+ $otherhash = DB_get_hash_from_game_and_pos($id,$mypos);
+ $othername = DB_get_name('hash',$otherhash);
+ echo "<a href=\"$INDEX?action=game&amp;me=$otherhash\">$othername</a><br />";
+ }
+ echo "</p>\n";
+ }
+
echo "</div>\n";
echo "</form>\n";
-if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' )
+if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' && isset($_SESSION['id']) && $_SESSION['id']==$myid)
{
$session = DB_get_session_by_gameid($gameid);
$result = DB_query("SELECT id,create_date FROM Game".