<?php require "header.php"; if (!Coach::isLoggedIn()) { die("You must be logged into OBBLM to use this webservice."); } $action = $_REQUEST["action"]; if ($action == "update") { $match = new Match($_POST["match_id"]); $match->update(array('submitter_id' => (int) $_SESSION['coach_id'], 'stadium' => (int) $_POST['stadium'], 'gate' => (int) $_POST['gate'] * 1000, 'fans' => (int) $_POST['fans'], 'ffactor1' => (int) $_POST['ff1'], 'ffactor2' => (int) $_POST['ff2'], 'income1' => (int) $_POST['inc1'] * 1000, 'income2' => (int) $_POST['inc2'] * 1000, 'team1_score' => (int) $_POST['result1'], 'team2_score' => (int) $_POST['result2'], 'smp1' => (int) $_POST['smp1'], 'smp2' => (int) $_POST['smp2'], 'tcas1' => (int) $_POST['tcas1'], 'tcas2' => (int) $_POST['tcas2'], 'fame1' => (int) $_POST['fame1'], 'fame2' => (int) $_POST['fame2'], 'tv1' => (int) $_POST['tv1'] * 1000, 'tv2' => (int) $_POST['tv2'] * 1000)); $team = new Team($_POST["team_id"]); foreach ($team->getPlayers() as $player) { if (!Match::player_validation($player, $match)) { continue; } // We create zero entries for MNG player(s). This is required! $pid = $player->player_id; if ($player->getStatus($match->match_id) == MNG) { $_POST["mvp_{$pid}"] = 0; $_POST["cp_{$pid}"] = 0; $_POST["td_{$pid}"] = 0; $_POST["intcpt_{$pid}"] = 0; $_POST["bh_{$pid}"] = 0; $_POST["si_{$pid}"] = 0; $_POST["ki_{$pid}"] = 0; $_POST["ir1_d1_{$pid}"] = 0; $_POST["ir1_d2_{$pid}"] = 0; $_POST["ir2_d1_{$pid}"] = 0; $_POST["ir2_d2_{$pid}"] = 0; $_POST["ir3_d1_{$pid}"] = 0; $_POST["ir3_d2_{$pid}"] = 0;
$_POST['coach'] = stripslashes($_POST['coach']); $_POST['passwd'] = stripslashes($_POST['passwd']); } if (!Coach::login($_POST['coach'], $_POST['passwd'], isset($_POST['remember']))) { $_GET['section'] = 'login'; } } $isMobile = isset($_GET['mobile']) ? $_GET['mobile'] == '1' : false; // Logout? if ($_VISSTATE['POST_OUT'] = isset($_GET['logout'])) { $_GET['section'] = 'main'; # Redirect logged out users to the main page. Coach::logout(); } Mobile::setIsMobile($isMobile); if ($isMobile && !Coach::isLoggedIn()) { // Redirect logged out mobile users to login $_GET['section'] = 'login'; } if ($_VISSTATE['COOCKIE'] || $_VISSTATE['POST_IN'] || $_VISSTATE['POST_OUT']) { setupGlobalVars(T_SETUP_GLOBAL_VARS__POST_COACH_LOGINOUT); } if (Mobile::isMobile()) { HTMLOUT::mobile_frame_begin(isset($_SESSION['logged_in']) ? $coach->settings['theme'] : $settings['stylesheet']); # Make page frame, banner and menu. MTS('Header loaded, login auth, html frame generated'); // Check if a menu-link was picked, and execute section code from sections.php accordingly. switch ($_GET['section']) { case 'login': sec_login(); break;