From 465e73265bc236531832686a8ae54894be928b81 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sat, 4 Aug 2007 11:38:17 -0700 Subject: LAYOUT: new user page mixed finished games, started games and games in progress into one table --- index.php | 106 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 45 insertions(+), 61 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index c2d93d2..de8dc1d 100644 --- a/index.php +++ b/index.php @@ -1714,86 +1714,70 @@ else if( myisset("email","password") || isset($_SESSION["name"]) ) /* display links to settings */ output_user_settings($email,$password); - echo "last login: ".date("r",$unixtime)."
"; + echo "
last login: ".date("r",$unixtime)."
"; DB_update_user_timestamp($myid); display_user_menu(); - echo "

These are your games that haven't started yet:

\n"; - $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand". - " LEFT JOIN Game On Hand.game_id=Game.id". - " WHERE Hand.user_id='$myid' AND Game.status='pre'". - " ORDER BY Game.session" ); - echo "

\n"; - while( $r = mysql_fetch_array($result,MYSQL_NUM)) - { - echo "game ".DB_format_gameid($r[1])." "; - if($r[3]==$myid || $r[3]==NULL) - echo "(it's your turn)\n"; - else - { - $name = DB_get_name_by_userid($r[3]); - echo "(it's $name's turn)\n"; - }; - - if(time()-strtotime($r[2]) > 60*60*24*30) - echo " The game has been running for over a month.". - " Do you want to cancel it? yes". - " (clicking here is final and can't be restored)"; - echo "
"; - } - echo "

\n"; - - echo "

These are the games you are playing in:

\n"; - $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand". - " LEFT JOIN Game On Hand.game_id=Game.id". - " WHERE Hand.user_id='$myid' AND Game.status='play'". - " ORDER BY Game.session" ); - echo "

\n"; - while( $r = mysql_fetch_array($result,MYSQL_NUM)) - { - echo "game ".DB_format_gameid($r[1])." "; - if($r[3]) - { - if($r[3]==$myid) - echo "(it's your turn)\n"; - else - { - $name = DB_get_name_by_userid($r[3]); - echo "(it's $name's turn)\n"; - }; - } - if(time()-strtotime($r[2]) > 60*60*24*30) - echo " The game has been running for over a month.". - " Do you want to cancel it? yes". - " (clicking here is final and can't be restored)"; - echo "
"; - } + echo "

These are all your games:

\n"; + echo "

Session:
\n"; + echo " p = pre-game phase "; + echo "P = game in progess "; + echo "F = game finished
"; echo "

\n"; - - echo "

And these are your games that are already done:

\n"; - echo "

Session:\n"; $output = array(); - $result = mysql_query("SELECT hash,game_id from Hand". + $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player,Game.status from Hand". " LEFT JOIN Game ON Game.id=Hand.game_id". - " WHERE user_id='$myid' AND Game.status='gameover'". + " WHERE user_id='$myid'". " ORDER BY Game.session,Game.create_date" ); - $gamenrold = 0; - echo "
\n"; + $gamenrold = -1; + echo "\n \n \n
\n"; while( $r = mysql_fetch_array($result,MYSQL_NUM)) { $game = DB_format_gameid($r[1]); $gamenr = (int) $game; if($gamenrold < $gamenr) { + if($gamenrold!=-1) + echo "
$gamenr: "; + else + echo "$gamenr: "; $gamenrold = $gamenr; - echo "
$gamenr: "; } - echo "I "; + if($r[4]=='pre') + { + echo "\n p "; + + } + else if ($r[4]=='gameover') + echo "\n F "; + else + { + echo "\n P "; + } + if($r[4] != 'gameover') + { + echo "
\n "; + if($r[3]) + { + if($r[3]==$myid) + echo "(it's your turn)\n"; + else + { + $name = DB_get_name_by_userid($r[3]); + echo "(it's $name's turn)\n"; + }; + } + if(time()-strtotime($r[2]) > 60*60*24*30) + echo " The game has been running for over a month.". + " Do you want to cancel it? yes". + " (clicking here is final and can't be restored)"; + + } } - echo "

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

Registered players:

\n

\n"; echo implode(", ",$names)."\n"; -- cgit v1.2.3-18-g5258