Example #1
0
function DeleteRecord($table, $where)
{
    //Select row and convert to string
    $sql = "SELECT * FROM {$table} WHERE {$where}";
    $result = mysqli_query($_SESSION['con'], $sql) or die(mysqli_error() . "Error in " . $sql);
    //Add serialized version of row to deleted table
    $row = serialize(mysqli_fetch_assoc($result));
    $sql = "INSERT INTO deleted (id,content) VALUES (UUID(),'{$row}')";
    UpdateDatabase($sql, '');
    //Delete row
    $sql = "DELETE FROM {$table} WHERE {$where}";
    UpdateDatabase($sql, 'Record deleted');
}
Example #2
0
            $tournamentKey = trim($customArray[0]);
        }
        if (count($customArray) > 1 && !empty($customArray[1])) {
            $submitKey = trim($customArray[1]);
        }
        if (count($customArray) > 2 && !empty($customArray[2])) {
            $players = trim($customArray[2]);
        }
    }
    if (DEBUG == true) {
        error_log(date('[Y-m-d H:i e] ') . "Verified IPN: {$req} " . PHP_EOL, 3, LOG_FILE);
    }
    if (!empty($tournamentKey)) {
        $logMessage = "submitKey = " . $submitKey . ", payment = " . $payment_amount . ", players = " . $players;
        $connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
        UpdateDatabase($connection, $tournamentKey, $submitKey, $payment_amount, $payerName, $payerEmail, $logMessage);
        $tournament = GetTournament($connection, $tournamentKey);
        // Send email if enabled and the payment amount is positive (not a refund)
        if (!empty($tournament) && $tournament->SendEmail && $payment_amount > 0) {
            $tournamentDates = GetFriendlyTournamentDates($tournament);
            SendSignupEmail($connection, $tournament, $tournamentDates, $submitKey, $web_site);
        }
        $connection->close();
    }
} else {
    if (strcmp($res, "INVALID") == 0) {
        // log for manual investigation
        // Add business logic here which deals with invalid IPN messages
        if (DEBUG == true) {
            error_log(date('[Y-m-d H:i e] ') . "Invalid IPN: {$req}" . PHP_EOL, 3, LOG_FILE);
        }