<?php require "../functions/main_fns.php"; require "../functions/mrm_fns.php"; open_db(); $current_match = now_match(); scoreboard($current_match);
if (strlen(array_get($_GET, 'code')) != 2) { message_error(lang_get('please_supply_country_code')); } $country = db_select_one('countries', array('id', 'country_name', 'country_code'), array('country_code' => $_GET['code'])); if (!$country) { message_error(lang_get('please_supply_country_code')); } head($country['country_name']); if (cache_start(CONST_CACHE_NAME_COUNTRY . $_GET['code'], CONFIG_CACHE_TIME_COUNTRIES)) { section_head(htmlspecialchars($country['country_name']) . country_flag_link($country['country_name'], $country['country_code'], true), '', false); $scores = db_query_fetch_all(' SELECT u.id AS user_id, u.team_name, u.competing, co.id AS country_id, co.country_name, co.country_code, SUM(c.points) AS score, MAX(s.added) AS tiebreaker FROM users AS u LEFT JOIN countries AS co ON co.id = u.country_id LEFT JOIN submissions AS s ON u.id = s.user_id AND s.correct = 1 LEFT JOIN challenges AS c ON c.id = s.challenge WHERE u.competing = 1 AND co.id = :country_id GROUP BY u.id ORDER BY score DESC, tiebreaker ASC', array('country_id' => $country['id'])); scoreboard($scores); cache_end(CONST_CACHE_NAME_COUNTRY . $_GET['code']); } foot();
function show_match($match_id) { if ($match_id != 8888) { $match_status = get_match_status($match_id); $query = "SELECT * FROM mrm_matches WHERE id =" . $match_id; $result = mysql_query($query); if (!$result) { echo $update . "<br>"; die('Error Querying Database. Code: sm123'); } $match = mysql_fetch_assoc($result); echo '<table id="mrm_current_match" border="0"> <tr> <td> ' . get_band_name($match['band1_id']) . '</td> <td></td> <td> ' . get_band_name($match['band2_id']) . '</td> </tr> <tr> <td> <img src="' . get_band_pic_url($match['band1_id']) . '"></td> <td class="middle" id="mrm_timer">'; if ($match_status == 'over') { echo 'Match Over'; } echo '</td> <td> <img src="' . get_band_pic_url($match['band2_id']) . '"></td></tr> <tr>'; echo "<td class=\"hidden\">"; countdown_values($match_id); echo "</td>"; echo "</tr>\n<tr>"; if ($match_status == 'early') { echo '<td colspan=3 class="center">Voting has not started yet</td>'; } elseif ($match_status == 'running') { if (has_voted($match_id) == false) { echo '<td class="center">'; vote_form($match["id"], 1); echo "</td>\n\n <td></td>\n\n <td class='center'>"; vote_form($match["id"], 2); echo '</td>'; } else { echo '<td colspan=3 class="center">Thanks for Voting!</td>'; } } elseif ($match_status == 'over') { echo '<td colspan=3></td>'; } echo "\n</tr>\n</table>\n"; if ($match_status != "early") { echo '<table id="mrm_scoring" border="0">'; scoreboard($match); echo '</table>'; } } if (end_of_madness()) { winner_banner(); } elseif (waiting_for_final()) { echo "<div class=\"top-spacer_20 center\"><strong>Hang in there, we are still counting up all of the votes...</strong></div>"; } else { next_match(); } }