Beispiel #1
0
<?php

require_once realpath($_SERVER["DOCUMENT_ROOT"]) . '/login.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/functions.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $script_folder . '/signup functions.php';
require_once realpath($_SERVER["DOCUMENT_ROOT"]) . $wp_folder . '/wp-blog-header.php';
date_default_timezone_set('America/Los_Angeles');
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) {
    die('db connect error: ' . $connection->connect_error);
}
// var_dump($_POST);
login($_POST['Login'], $_POST['Password']);
if ($_POST['Action'] == 'Delete') {
} else {
    if ($_POST['Action'] == 'UpdatePaymentMade') {
        $tournamentKey = $_POST['TournamentKey'];
        for ($i = 0; $i < count($_POST['Signup']); ++$i) {
            UpdateSignup($connection, $_POST['Signup'][$i]['SignupKey'], 'Payment', $_POST['Signup'][$i]['PaymentMade'], 'd');
        }
    }
}
echo "Success";
 if (count($playersRemoved) > 0) {
     if ($tournament->RequirePayment) {
         $cost = $tournament->Cost;
         if ($testMode) {
             $cost = 3;
         }
         $paypalDetails = GetPayPalDetails($connection, $cost);
         if (!isset($paypalDetails->PayPayButton)) {
             die("No PayPal button for tournament fee " . $cost);
         }
         $refundFees = count($playersRemoved) * ($paypalDetails->TournamentFee + $paypalDetails->ProcessingFee);
         $remainingFees = $signup->PaymentDue - $refundFees;
         if ($remainingFees < 0) {
             $remainingFees = 0;
         }
         UpdateSignup($connection, $signupKey, 'PaymentDue', $remainingFees, 'd');
         // If they have paid, request a refund
         if ($signup->Payment > 0) {
             SendRefundEmail($connection, $tournament, $signup, $players, $playersRemoved, $refundFees, $web_site);
             $refundRequested = true;
         }
     }
 }
 // This is a team event.  We removed a player from team 1 and there is a full team 2.  Move team 2 to
 // team 1 and move the single to team 2 so the empty slot is last.
 if ($tournament->TeamSize == 2 && count($playersRemoved) == 1 && count($players) == 4 && $playerIndexRemoved < 2) {
     for ($i = 0; $i < 4; ++$i) {
         if ($i != $playerIndexRemoved) {
             if ($players[$i]->Position == 0 || $players[$i]->Position == 1) {
                 // Move the single from the 1st team to the second team
                 UpdateSignupPlayer($connection, $signupKey, $players[$i]->GHIN, 'Position', 2, 'i');
Beispiel #3
0
        echo '</table>' . PHP_EOL;
    } else {
        AddPlayerTable($t);
        AddPlayer($t, 1, $players, $Extra, $flightErrorList);
        AddPlayer($t, 2, $players, $Extra, $flightErrorList);
        AddPlayer($t, 3, $players, $Extra, $flightErrorList);
        AddPlayer($t, 4, $players, $Extra, $flightErrorList);
        RequestedTime($RequestedTime);
        echo '</table>' . PHP_EOL;
    }
    echo '<input type="hidden" name="tournament" value="' . $tournamentKey . '">' . PHP_EOL;
    echo '<input type="submit" value="Submit"> <br> <br>' . PHP_EOL;
    echo '</form>' . PHP_EOL;
} else {
    // Make the modifications
    UpdateSignup($connection, $signupKey, 'RequestedTime', $RequestedTime, 's');
    if ($t->TeamSize == 2 && $t->SCGAQualifier) {
        for ($i = 0; $i < count($players); ++$i) {
            UpdateSignupPlayer($connection, $signupKey, $players[$i]->GHIN, 'Extra', $Extra[$i], 's');
        }
    } else {
        if ($t->SrClubChampionship) {
            for ($i = 0; $i < count($players); ++$i) {
                UpdateSignupPlayer($connection, $signupKey, $players[$i]->GHIN, 'Extra', $Extra[$i], 's');
            }
        }
    }
    echo '<p>' . PHP_EOL;
    echo 'Your changes have been saved.' . PHP_EOL;
    echo '</p>' . PHP_EOL;
}
Beispiel #4
0
 $players2 = GetPlayersForSignUp($connection, $signup2->SignUpKey);
 if (count($players2) == 0) {
     die("There are no players for added group signup code " . $signup2->SignUpKey);
 }
 // Update the signup position for the players merging into the
 // group. Position is 0 based.
 $position = count($players);
 for ($i = 0; $i < count($players2); ++$i) {
     UpdateSignupPlayer($connection, $signup2->SignUpKey, $players2[$i]->GHIN, 'Position', $position, 'i');
     ++$position;
     // Change the signup key to be the key for the 1st group
     UpdateSignupPlayer($connection, $signup2->SignUpKey, $players2[$i]->GHIN, 'SignUpKey', $signupKey, 'i');
 }
 // Update the payment and payment due to be the sum of the 2 groups
 UpdateSignup($connection, $signupKey, 'Payment', $signup->Payment + $signup2->Payment, 'd');
 UpdateSignup($connection, $signupKey, 'PaymentDue', $signup->PaymentDue + $signup2->PaymentDue, 'd');
 // Remove the 2nd signup
 DeleteSignup($connection, $signup2->SignUpKey);
 echo '<p>The new players have been added to your group.</p>' . PHP_EOL;
 $players = GetPlayersForSignUp($connection, $signupKey);
 if ($t->TeamSize == 2 && $t->SCGAQualifier) {
     if (count($players) >= 2) {
         if ($players[0]->Extra !== $players[1]->Extra) {
             echo '<p style="color:red;">The flight choices for players 1 & 2 do not match. Use the Modify action from the View Signups page to update the flight choice.' . PHP_EOL;
         }
     }
     if (count($players) == 4) {
         if ($players[2]->Extra !== $players[3]->Extra) {
             echo '<p style="color:red;">The flight choices for players 3 & 4 do not match. Use the Modify action from the View Signups page to update the flight choice.' . PHP_EOL;
         }
     }