$leagueID = leagueHandler($_POST, $userID);
debug("League is {$leagueID}");
$season = getSeason();
?>


To join a league, choose the league you're looking to join, the password provided by its administrator, and the name of your team. You can only join a league once. If a league's registration deadline has passed, it does not appear on the list.<p/>
<?php 
debug($_POST["action"]);
if ($_POST["action"] == "leagueEnroll") {
    $pass = getSingleton("fch_leagues", "pw", " where id = " . $_POST['leagueID'] . " and season = \"" . getSeason() . "\"");
    debug("Criteria -- displName=" . $_POST["teamDisplayName"] . " pw=" . $_POST['password'] . " pass="******"teamDisplayName"]) > 0) {
        echo displayResults(addGMToLeague($_POST["leagueID"], $userID, $_POST["teamDisplayName"]));
    } else {
        echo displayResults(getReturnCode(0, "Sorry, your password was incorrect or you didn't enter a team name."));
    }
}
?>

 <div class="contact-form">
<form  name="leagueEnroll" method="post" class="form-validate form-horizontal" >
			<input name = "action" value = "leagueEnroll" type = "hidden">
  
		<fieldset>
			<legend>What League Would You Like to Join?</legend>
			<div class="control-group">
				<div class="control-label">
					<label id="jform_contact_name-lbl" for="jform_contact_name" class="hasTooltip required" title="&lt;strong&gt;Name&lt;/strong&gt;&lt;br /&gt;Your name.">
						League</label>
				</div>
function nextDraftOrder($leagueID)
{
    $picksSoFar = intval(selectCount("fch_draft", " WHERE leagueID = {$leagueID}"));
    $totalPlayers = intval(selectCount("fch_league_membership", " WHERE leagueID = {$leagueID} and status = \"active\""));
    $max = getLastPickNumber($leagueID) + 1;
    // because we want the NEXT player
    $season = getSeason();
    debug($picksSoFar . " " . $totalPlayers . " " . $max);
    if (!($totalPlayers > 0)) {
        displayResults(getReturnCode(0, "Error: No players in this league."));
    }
    $quotient = intval(($max - 1) / $totalPlayers);
    debug("quotient {$quotient}");
    $mod = ($max - 1) % $totalPlayers + 1;
    debug("mod {$mod}");
    if ($quotient % 2 == 0) {
        $r = intval($mod);
        debug("{$r} = r");
    } else {
        $r = intval($totalPlayers - $mod + 1);
        debug("{$r} = r");
    }
    return $r;
}
Esempio n. 3
0
if (strlen($_POST["action"]) > 0) {
    $_GET = null;
}
////////// GET
if ($_GET["action"] == "rescind") {
    $r = executeGenericSQL("UPDATE fch_draft SET playerID = \"WithdrawnPick\" , position = \"X\" , status = \"W\" WHERE leagueID = " . $_GET[leagueID] . " AND overallPick = " . intval($_GET[pickID]));
    if ($r["status"] == 1) {
        echo displayResults(getReturnCode(1, "Your pick was successfully withdrawn."));
    } else {
        echo displayResults(getReturnCode(0, "There has been an error and your pick was not withdrawn."));
    }
}
if ($_GET["action"] == "closeDraft") {
    executeGenericSql("UPDATE fch_leagues SET draftStatus = \"closed\" WHERE id = {$leagueID} and season = \"{$season}\"");
    closeDraft($leagueID);
    echo displayResults(getReturnCode(1, "The draft is officially closed."));
}
if (selectCount("fch_players", " WHERE playerID = \"WithdrawnPick\"") == 0) {
    executeGenericSQL("INSERT INTO fch_players SET playerID = \"WithdrawnPick\", schoolID = \"pc\" , season = \"{$season}\"");
}
if (selectCount("fch_players", " WHERE playerID = \"PassedPick\"") == 0) {
    executeGenericSQL("INSERT INTO fch_players SET playerID = \"PassedPick\", schoolID = \"pc\" , season = \"{$season}\"");
}
$leagueAdmin = getSingleton("fch_leagues", "admin_user", " WHERE id = {$leagueID} and season = \"{$season}\"");
// Is user the admin?
if (intval($leagueAdmin) == intval($userID)) {
    $userIsAdmin = true;
} else {
    $userIsAdmin = false;
}
if (getSingleton("fch_leagues", "draftStatus", " WHERE id = {$leagueID} and season = \"{$season}\"") != "open") {
    }
}
if ($_POST["action"] == "removeGM") {
    if (!okToTransact($_POST["transactionID"])) {
        echo displayResults(getReturnCode(0, "This transaction has already been completed. Please do not use the refresh button."));
    } else {
        $gmToDelete = intval($_POST["gmToDelete"]);
        debug("Removing {$gmToDelete} from league {$leagueID}");
        $r = executeGenericSQL("UPDATE fch_league_membership SET status = \"removed\" WHERE userID = {$gmToDelete} and {$leagueID} = leagueID and season = \"{$season}\"");
        if ($r != -1) {
            $r = executeGenericSQL("UPDATE fch_rosters SET releaseDate = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL +3 HOUR) where  userID = {$gmToDelete} and leagueID = {$leagueID} and  releaseDate is NULL and season = \"{$season}\" ");
            if ($r != -1) {
                echo displayResults(getReturnCode(1, "Successfully removed this GM."));
            }
        } else {
            echo displayResults(getReturnCode(0, "There has been an error releasing this GM's players."));
        }
    }
    setTransactionComplete($_POST["transactionID"]);
}
?>

   
   <h3>More Admin Tools Coming Soon.</h3>
   
   <h4>Registration Deadline</h4>
   <?php 
echo getSingleton("fch_leagues", "registrationDeadline", " WHERE id = {$leagueID} and season = \"{$season}\"");
?>