Beispiel #1
0
                            return;
                        }
                    } else {
                        if ($action == 'update') {
                            if (!UpdateQuest($userID, $id)) {
                                CompleteTransaction("Can not update quest");
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
}
CompleteTransaction(null);
//Success!
return;
function CheckQuestOwnership($userID, $id)
{
    $checkResults = mysql_query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(p_ID)\r\n\t\tFROM\r\n\t\t\ttblQuests\r\n\t\tWHERE\r\n\t\t\tp_ID = {$id}\r\n\t\t\tAND UserID = {$userID}\r\n\t\t");
    if (!$checkResults) {
        //Error with query
        return 0;
    }
    $checkCount = mysql_num_rows($checkResults);
    if ($checkCount == 0) {
        return 0;
    }
    return 1;
}
            // Sandbox
            //		$redirecturl = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=$token";
            //Live
            $redirecturl = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={$token}";
            header("Location: {$redirecturl}");
        } else {
            // TODO: registration paypal error page - cover common paypal error codes
            echo "Paypal transaction processing failed.  Summit staff has been notified, please check your paypal payment sources or try again later.  Sorry for the inconvenience.";
            $message .= print_r($paypal_response, true);
            $message .= "\r\n";
            $message .= print_r($_SESSION, true);
            sendErrorEmail($message);
        }
    }
} else {
    if (isset($_GET['confirm'])) {
        $transaction_results = CompleteTransaction($_SESSION['itemName'], $_SESSION['itemCost'], $_GET['token'], $_GET['PayerID']);
        if (strpos($transaction_results['ACK'], 'Success') !== FALSE) {
            // Complete registration, store information
            updateRegistration($conn, $transaction_results);
        } else {
            echo "Paypal transaction processing failed.  Summit staff has been notified, please check your paypal payment sources or try again later.  Sorry for the inconvenience.";
            $message .= print_r($transaction_results, true);
            $message .= "\r\n";
            $message .= print_r($_SESSION, true);
            sendErrorEmail($message);
        }
    } else {
        header('Location: http://www.smashsummit.ca/');
    }
}