Exemple #1
0
//confirmation tests
$CONFIRM = FALSE;
if ($CONFIRM) {
    echo '<h3 style="color:blue">Confirmation Test</h3>';
    if (empty(CONFIRM_TOKEN)) {
        //request a confirmation email
        $confirm_email = GoCoin::requestConfirmationEmail($token, USER_EMAIL);
        if ($confirm_email->code == '204') {
            echo '<div style="color:#008800">Confirmation email requested!</div>';
        } else {
            echo '<div style="color:#aa0000">Confirmation email failure:</div>';
            var_dump($confirm_email);
        }
    } else {
        //confirm a user account
        $confirm_account = GoCoin::confirmUser($token, USER_ID, CONFIRM_TOKEN);
        if ($confirm_account->code == '301') {
            echo '<div style="color:#008800">Confirm account success!</div>';
        } else {
            echo '<div style="color:#aa0000">Confirm account failure:</div>';
            var_dump($confirm_account);
        }
        //the following code is an example of actually following
        //the redirect if one has been given in the method call
        $REDIRECT = FALSE;
        if ($REDIRECT) {
            if (property_exists($confirm_account, 'location')) {
                header("Location: " . $confirm_account->location);
                return;
            }
        }