login($_POST['Login'], $_POST['Password']); if (!isset($_POST['GHIN'])) { die("No GHIN provided."); } else { if (!isset($_POST['Name'])) { die("No name provided."); } else { if (!isset($_POST['Payment'])) { die("No payment provided."); } else { $now = new DateTime("now"); $year = $now->format('Y'); $payment = $_POST['Payment']; $player = GetPlayerDues($connection, $_POST['GHIN']); if (empty($player)) { InsertPlayerForDues($connection, $year + 1, $_POST['GHIN'], $_POST['Name']); } else { // Update name in case the name was uploaded wrong the first time because // auto-complete was off in WebAdmin and they typed in a name and GHIN. UpdateName($connection, $_POST['GHIN'], $_POST['Name']); // If set from WebAdmin, make the starting point 0 by subtracting what is already // in the payment field. if ($player->Payment > 0) { $payment = $payment - $player->Payment; } } $logMessage = "GHIN = " . $_POST['GHIN'] . ", name = " . $_POST['Name'] . ", payment = " . $_POST['Payment']; UpdateDuesDatabase($connection, $_POST['GHIN'], $payment, "WebAdmin", "", "WebAdmin: " . $logMessage); $connection->close(); echo 'Success'; }
echo ' name="Player[Email]" value="' . $Email . '"></td>' . PHP_EOL; echo '</tr>' . PHP_EOL; //insert_error_line($error, 2); echo '</table>' . PHP_EOL; if (isset($error)) { echo '<p style="color:red;">' . PHP_EOL; echo $error . PHP_EOL; echo '</p>' . PHP_EOL; } echo '<input type="submit" value="Step 1: Verify input data"> <br> <br>' . PHP_EOL; echo '</form>' . PHP_EOL; echo '</div><!-- #content -->' . PHP_EOL; echo '</div><!-- #content-container -->' . PHP_EOL; } else { if (empty($playerDues)) { InsertPlayerForDues($connection, $year + 1, $GHIN, $FullName); // for testing //UpdateDuesDatabase($connection, $GHIN, 150, "Player 1", "Player Email", "original string from paypal"); //SendDuesEmail($connection, $GHIN, 150, $web_site); } echo '<div id="content-container" class="entry-content">' . PHP_EOL; echo '<div id="content" role="main">' . PHP_EOL; echo '<h2 class="entry-title" style="text-align:center">Pay Yearly Dues</h2>' . PHP_EOL; echo '<p>You must pay the dues now. You have not payed your dues until the PayPal step is complete!</p>' . PHP_EOL; echo "<p>The link below takes you to PayPal to make your payment. You can pay with credit card even if you do not have a PayPal account. No credit card or account information is kept on the Coronado Men's Golf web site.</p>" . PHP_EOL; echo '<p style="text-align: center;"><b>Dues: $' . number_format($paypalDetails->TournamentFee, 2) . '</b></p>' . PHP_EOL; echo '<form style="text-align:center" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">' . PHP_EOL; echo '<input type="hidden" name="cmd" value="_s-xclick">' . PHP_EOL; echo '<input type="hidden" name="hosted_button_id" value="' . $paypalDetails->PayPayButton . '">' . PHP_EOL; echo '<input type="hidden" name="item_name" value="Yearly Dues">' . PHP_EOL; echo '<input type="hidden" name="custom" value="Yearly Dues;' . $GHIN . ';' . $LastName . '">' . PHP_EOL;