コード例 #1
0
ファイル: get_signups.php プロジェクト: palbitz1003/CMGC
<?php

require_once realpath($_SERVER["DOCUMENT_ROOT"]) . '/login.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/signup functions.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/tournament_functions.php';
date_default_timezone_set('America/Los_Angeles');
$tournamentKey = $_POST['tournament'];
if (!$tournamentKey) {
    die("Which tournament?");
}
$connection = new mysqli('p:' . $db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) {
    die($connection->connect_error);
}
$tournament = GetTournament($connection, $tournamentKey);
$signUpArray = GetSignups($connection, $tournamentKey, 'ORDER BY `SubmitKey` ASC');
//var_dump($signUpArray);
for ($i = 0; $i < count($signUpArray); ++$i) {
    $playersSignedUp = GetPlayersForSignUp($connection, $signUpArray[$i]->SignUpKey);
    $players = null;
    for ($p = 0; $p < count($playersSignedUp); ++$p) {
        if (!empty($players)) {
            $players = $players . ",";
        }
        $extra = $playersSignedUp[$p]->Extra;
        if (strlen($extra) == 0 && $playersSignedUp[$p]->GHIN === 0) {
            $extra = "N";
        }
        if ($extra === "G" && $tournament->MemberGuest) {
            $extra = $playersSignedUp[$p]->GHIN;
        }
コード例 #2
0
<?php

require_once realpath($_SERVER["DOCUMENT_ROOT"]) . '/login.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/tournament_functions.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/results_functions.php';
date_default_timezone_set('America/Los_Angeles');
$connection = new mysqli('p:' . $db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) {
    die($connection->connect_error);
}
if (isset($_POST['TournamentKey'])) {
    $tournamentKey = $_POST['TournamentKey'];
} else {
    die('TournamentKey is not set');
}
$t = GetTournament($connection, $_POST['TournamentKey']);
$ctpArray = GetClosestToThePin($connection, $tournamentKey, $t->StartDate);
SendClosestToThePin($ctpArray);
if (strcmp($t->StartDate, $t->EndDate) != 0) {
    $ctpArray = GetClosestToThePin($connection, $tournamentKey, $t->EndDate);
    SendClosestToThePin($ctpArray);
}
function SendClosestToThePin($ctpArray)
{
    for ($i = 0; $i < count($ctpArray); ++$i) {
        echo $ctpArray[$i]->Hole . ',';
        echo $ctpArray[$i]->Date . ',';
        echo $ctpArray[$i]->GHIN . ',';
        echo '"' . $ctpArray[$i]->Name . '"' . ',';
        // name can have commas, so escape it
        echo $ctpArray[$i]->Distance . ',';
コード例 #3
0
function DeleteTournament($connection, $tournamentKey)
{
    $t = GetTournament($connection, $tournamentKey);
    if (is_null($t)) {
        die('Tournament with key ' . $tournamentKey . ' does not exist');
    }
    // Clear all the tables that have tournament related data
    ClearTableWithTournamentKey($connection, 'Chits', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'ClosestToThePin', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'Pool', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'Scores', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'SignUps', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'SignUpsPlayers', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'TeeTimes', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'TeeTimesPlayers', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'TournamentDetails', $tournamentKey);
    ClearTableWithTournamentKey($connection, 'Tournaments', $tournamentKey);
}
コード例 #4
0
ファイル: signup functions.php プロジェクト: palbitz1003/CMGC
function ShowSignups($connection, $tournamentKey)
{
    $t = GetTournament($connection, $tournamentKey);
    echo '<h2 style="text-align:center">' . $t->Name . ' Signups</h2>' . PHP_EOL;
    echo '<table style="border: none; margin-left:auto;margin-right:auto;">' . PHP_EOL;
    echo '<tbody>' . PHP_EOL;
    if ($t->SrClubChampionship) {
        echo '<tr><td style="border: none">' . PHP_EOL;
        echo 'F1 = Flight 1 (under 55)<br>' . PHP_EOL;
        echo 'F2 = Flight 2 (55-59)<br>' . PHP_EOL;
        echo 'F3 = Flight 3 (60-69)<br>' . PHP_EOL;
        echo 'F4 = Flight 4 (70 and older)<br>' . PHP_EOL;
        echo 'CH = Championship Flight (55 and older)<br><br>' . PHP_EOL;
        echo '</td></tr>' . PHP_EOL;
    }
    $signUpArray = GetSignups($connection, $tournamentKey, ' AND `Payment` < `PaymentDue` ORDER BY `SubmitKey` DESC');
    if (!empty($signUpArray)) {
        echo '<tr><td style="border: none">';
        echo 'These players have not paid their tournament fee. You are not in the tournament until your fee has been paid. ';
        echo '</td></tr>' . PHP_EOL;
        echo '<tr><td style="border: none">';
        echo 'If you have completed payment, but it is not yet recorded, be patient as PayPal may not have notified us yet. ';
        echo 'Notify the tournament director if payment is not recorded after 24 hours.';
        echo '</td></tr>' . PHP_EOL;
        echo '<tr><td style="border: none">' . PHP_EOL;
        ShowSignupsTable($connection, $tournamentKey, $signUpArray, $t);
        echo '</td></tr>' . PHP_EOL;
    }
    $signUpArray = GetSignups($connection, $tournamentKey, ' AND `Payment` >= `PaymentDue` ORDER BY `SubmitKey` DESC');
    if (!empty($signUpArray)) {
        if ($t->RequirePayment) {
            echo '<tr><td style="border: none">These players have signed up and have paid.</td></tr>';
        } else {
            echo '<tr><td style="border: none">These players have signed up.</td></tr>';
        }
        echo '<tr><td style="border: none">' . PHP_EOL;
        ShowSignupsTable($connection, $tournamentKey, $signUpArray, $t);
        echo '</td></tr>' . PHP_EOL;
    }
    echo '</tbody></table>' . PHP_EOL;
}
コード例 #5
0
// echo '<br>';
// var_dump($_FILES);
// echo '<br>';
login($_POST['Login'], $_POST['Password']);
if ($_FILES["file"]["error"] > 0) {
    echo "Error: " . $_FILES["file"]["error"] . "<br>";
} else {
    // echo "Upload: " . $_FILES["file"]["name"] . "<br>";
    // echo "Type: " . $_FILES["file"]["type"] . "<br>";
    // echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    // echo "Stored in: " . $_FILES["file"]["tmp_name"];
    if ($_POST['Action'] == 'Submit') {
        if (!IsHTML($_FILES['file']['tmp_name'])) {
            die('Submitted file does not start with "<html"');
        }
        $t = GetTournament($connection, $_POST["TournamentKey"]);
        if (!isset($t)) {
            die('This is not a valid tournament key: ' . $_POST["TournamentKey"]);
        }
        $start = new DateTime($t->StartDate);
        $fileName = sprintf('%s %s %d.html', $start->format('Y M d'), $_POST["Result"], $_POST["TournamentKey"]);
        // echo 'new file name ' . $fileName;
        // Update tournament details
        switch ($_POST["Result"]) {
            case 'scores':
                UpdateTournamentDetails($connection, $_POST["TournamentKey"], 'ScoresFile', $fileName);
                UpdateTournamentDetails($connection, $_POST["TournamentKey"], 'ScoresPostedDate', date('Y-m-d'));
                break;
            case 'chits':
                UpdateTournamentDetails($connection, $_POST["TournamentKey"], 'ChitsFile', $fileName);
                UpdateTournamentDetails($connection, $_POST["TournamentKey"], 'ChitsPostedDate', date('Y-m-d'));
コード例 #6
0
ファイル: send_email.php プロジェクト: palbitz1003/CMGC
get_sidebar();
$signupKey = $_GET['signup'];
if (!$signupKey) {
    get_header();
    get_sidebar();
    die("Which signup?");
}
$connection = new mysqli('p:' . $db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) {
    die($connection->connect_error);
}
$signup = GetSignup($connection, $signupKey);
if (empty($signup)) {
    die("Did not find a signup for key: " . $signupKey);
}
$tournament = GetTournament($connection, $signup->TournamentKey);
if (empty($tournament)) {
    die("Did not find tournament for key: " . $signup->TournamentKey);
}
$tournamenDates = GetFriendlyTournamentDates($tournament);
//$errors = SendSignupEmail($connection, $tournament, $tournamenDates, $signupKey, $web_site);
if (!empty($errors)) {
    echo "Error: " . $errors . "<br>";
}
$players = GetPlayersForSignUp($connection, $signupKey);
$playersRemoved[] = "none";
$refundFees = "as much as you can";
//SendRefundEmail($connection, $tournament, $signupKey, $players, $playersRemoved, $refundFees, $web_site);
if (isset($connection)) {
    $connection->close();
}