function execPayment($member_id, $order_id, $card_no, $expire, $security_code, $holder_name, $amount)
{
    global $log;
    $log = new Log("payment_api");
    try {
        //search member
        $result = searchMember($member_id, false);
        if ($result == false) {
            // entryMember
            saveMember($member_id);
        }
        // search Card
        $result = searchCard($member_id, false);
        if ($result == false) {
            // save card
            saveCard($member_id, $card_no, $expire, $security_code, $holder_name);
        }
        // entry & exec tran
        execTran($member_id, $order_id, $amount);
        // traded cad
        //tradedCard( $member_id, $order_id, $holder_name );
    } catch (Exception $e) {
        $log->error("execPaiment ERROR_CODE=" . $e->getMessage());
        $log->error(serialize($e));
        return $e->getMessage();
    }
    return true;
}
 }
 // Sign in form postback
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     // Confirm that the user has provided the correct current password
     if (validateLogin($_POST['user']['email'], $_POST['user']['current_password'])) {
         $creditCardId = NULL;
         $newPassword = NULL;
         $newCard = array_map('trim', $_POST['user']['credit_card']);
         $newValues = count(array_filter($newCard, 'strlen'));
         // Update credit card info if new credit card data has been provided
         if ($newValues > 0 && $newValues < 5) {
             $message = "Please fill in all required credit card values.";
             $messageType = "error";
         } else {
             if ($newValues == 5) {
                 $creditCardId = saveCard($newCard);
                 $card = getCreditCard($creditCardId);
             }
         }
         // Update password if new password data has been provided
         if (isset($_POST['user']['password'])) {
             if ($_POST['user']['password'] == $_POST['user']['password_confirmation']) {
                 $newPassword = $_POST['user']['password'];
             } else {
                 $message = "The new password did not match your confirm password.";
                 $messageType = "error";
             }
         }
         // update credit card info OR/AND password in our database
         if (!isset($message) && (isset($newPassword) || isset($creditCardId))) {
             updateUser($_POST['user']['email'], $newPassword, $creditCardId);
require_once __DIR__ . '/../bootstrap.php';
session_start();
// Sign up form postback
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (trim($_POST['user']['email']) == '' || $_POST['user']['password'] == '') {
        $errorMessage = "You must enter a email address and password to register.";
    } else {
        if ($_POST['user']['password'] != $_POST['user']['password_confirmation']) {
            $errorMessage = "Passwords do not match. Please check.";
        } else {
            try {
                $creditCardId = NULL;
                // User can configure credit card info later from the
                // profile page or can use paypal as his funding source.
                if (trim($_POST['user']['credit_card']['number']) != "") {
                    $creditCardId = saveCard($_POST['user']['credit_card']);
                }
                $userId = addUser($_POST['user']['email'], $_POST['user']['password'], $creditCardId);
            } catch (PPConnectionException $ex) {
                $errorMessage = $ex->getData() != '' ? parseApiError($ex->getData()) : $ex->getMessage();
            } catch (Exception $ex) {
                $errorMessage = $ex->getMessage();
            }
        }
    }
    if (isset($userId) && $userId != false) {
        signIn($_POST['user']['email']);
        header("Location: ../index.php");
        exit;
    }
}