"; start_menu_bar("#8b0000"); display_menu_item("Games", "iphone_games.php", 7, 7, 2, "#008b00"); display_menu_item("Units", "iphone_pieces.php", 7, 5, 2, "#008b00"); display_menu_item("Leaders", "iphone_leaders.php", 7, $topnum, 2, "#008b00"); display_menu_item("League", "iphone_league.php", 7, $topnum, 2, "#008b00"); display_menu_item("Home", "index.php", 7, $topnum, 2, "#008b00"); end_menu_bar(); print ""; print "
"; show_users_online($dbh); $rank = get_sql_item($dbh, "select rank from SP_USER where name = '$user_login'"); if($rank>1) show_gamesXXX($dbh, "My", $user_login); if($dupe_player_flg == "Y") { print "Sorry, this account has been disabled. Please use your regular account."; exit; } print "
"; #if($rank>1) { show_games($dbh, 2, $user_login); } if($rank>1) { show_all_games($dbh, $user_login, "Open"); } mysql_close($dbh); #----------------------- function show_all_games($dbh, $user_login, $type) { if($type=="Open") { print "Open Games
"; $status = "'Open'"; $turn = "Host"; } else { print "In Progress Games
"; $status = "'Playing', 'Picking Nations'"; $turn = "Turn"; } black_border_box("white", "nowrap"); print "\n"; print "\n"; $sql = "select * from SP_GAME where status in ($status) and type not in ('test', 'training') order by status, row_id"; $result = mysql_query($sql, $dbh); print mysql_error(); while($row = mysql_fetch_array($result)) { $game_id = $row[row_id]; $name = $row[name]; $status = $row[status]; $type = $row[type]; $size = $row[max_players]; $created = $row[created]; $round = $row[round]; $turn = $row[turn]; $featured_game_flag = $row[featured_game_flag]; $time_remaining = get_time_remaining2($dbh, $game_id); $created = get_sql_item($dbh, "select DATE_FORMAT(created, '%b %d') from SP_GAME where row_id = '$game_id'"); $num_players = get_num_players2($dbh, $game_id); if($num_players>$size) { $num_players=$size; } $uid = get_sql_item($dbh, "select user from SP_PLAYER where row_id = '$turn'"); $userName = get_user_graphic_link($dbh, $uid); $player_status = get_sql_item($dbh, "select status from SP_PLAYER where row_id = '$turn'"); $pStatus=""; if($player_status!="Purchase" and $status == "Playing") { $pStatus = "($player_status)"; } $host_name = get_sql_item($dbh, "select name from SP_USER where row_id = '$uid'"); if($status=="Open") { $bgcolor="#CCFFCC"; $name = "$name"; } else { $bgcolor="white"; $name = "$name"; } $player_list = get_player_alt_list($dbh, $game_id); $promoText = check_for_promotions($dbh, $game_id, 20); print ""; print "\n"; } #<-- white print "
Game Players
$name
$type
$created
$userName
"; print "
"; print ""; print "
"; print "
$num_players/$size

$player_list
\n"; black_border_end_box(); } function get_player_alt_list($dbh, $game_id, $type) { $player_list = ""; $sql = "select * from SP_PLAYER where game = '$game_id'"; $result = mysql_query($sql, $dbh); print mysql_error(); while($row = mysql_fetch_array($result)) { $row_id = $row[row_id]; $money = $row[income]; $user = $row[user]; $team = $row[team]; $nation = $row[nation]; $nation = ""; $name = get_sql_item($dbh, "select name from SP_USER where row_id = '$user'"); $player_list .= "$name
"; } #<-- while return($player_list); } function show_gamesXXX($dbh, $status, $user_login) { $user_id = get_sql_item($dbh, "select row_id from SP_USER where name = '$user_login'"); $count = get_sql_item($dbh, "select count(*) from SP_GAME where status in ('Open', 'Picking Nations', 'Playing') and row_id in (select game from SP_PLAYER where user = '$user_id')"); $sql = "select distinct(game) from SP_PLAYER where user=$user_id"; $result = mysql_query($sql, $dbh); print mysql_error(); print ""; while($row = mysql_fetch_array($result)) { $row_id = $row[game]; $status = get_sql_item($dbh, "select status from SP_GAME where row_id = '$row_id'"); if($status=="Picking Nations" or $status=="Playing" or $status=="Open") { show_this_igame($dbh, $row_id, $user_id); } } #<-- white print "
GamePlayers
"; print "

"; } function show_this_igame($dbh, $row_id, $user_id) { $sql = "select * from SP_GAME where row_id=$row_id"; $result = mysql_query($sql, $dbh); print mysql_error(); $bgcolor="white"; $time_remaining = get_time_remaining2($dbh, $row_id); while($row = mysql_fetch_array($result)) { $row_id = $row[row_id]; $name = $row[name]; $status = $row[status]; $host = $row[host]; $type = $row[type]; $round = $row[round]; $turn = $row[turn]; $tid = get_sql_item($dbh, "select user from SP_PLAYER where row_id = '$turn'"); if($status=="Open") $bgcolor = "#ccffcc"; if($status=="Playing" and $tid==$user_id) $bgcolor = "yellow"; if($status=="Playing") $name = "$name"; print " $name
Status: $status
Type: $type
Round: $round
$time_remaining
"; show_players_in_igame($dbh, $row_id, $status, $user_id, $user_login, $host, $type); print ""; } #<-- white } function show_players_in_igame($dbh, $game_id, $status, $user_id, $user_login, $host, $type) { $orig_player_list = get_sql_item($dbh, "select orig_player_list from SP_GAME where row_id = '$game_id'"); $players = split("\+", $orig_player_list); print ""; foreach($players as $player) { $money = get_sql_item($dbh, "select income from SP_PLAYER where row_id = '$player'"); $user_name = get_sql_item($dbh, "select name from SP_USER where row_id = (select user from SP_PLAYER where row_id = '$player')"); $uid = get_sql_item($dbh, "select user from SP_PLAYER where row_id = '$player'"); $nation = get_sql_item($dbh, "select nation from SP_PLAYER where row_id = '$player'"); $nation_name = get_sql_item($dbh, "select name from SP_NATION where row_id = (select nation from SP_PLAYER where row_id = '$player')"); $player_status = get_sql_item($dbh, "select status from SP_PLAYER where row_id = '$player'"); if($nation_name=="" and $player_status=="") { print "Error - something is hosed!!"; } print "\n"; } print "
"; if($nation>0) { print "$nation_name"; } print ""; if($player_status=="Loss") { print ""; } $player_count++; $bootP=""; if($player_status == "Purchase" or $player_status == "Attack" or $player_status == "Move" or $player_status == "Place Units" or $player_status == "Choosing") { print "*"; } $userName = get_sql_item($dbh, "select name from SP_USER where row_id = '$uid'"); print "$userName$money
"; } ?>