Beispiel #1
0
        // account management page
        header("Location: /account");
        exit;
    }
}
/* is there a token? (i.e. user coming in via a confirmation email) */
if (!is_null($q_t)) {
    $q_t = preg_replace('#</a$#', '', $q_t);
    /* Process emailed token */
    $d = auth_token_retrieve('login', $q_t);
    if (!$d) {
        err(sprintf(_("Please check the URL (i.e. the long code of letters and numbers) is copied correctly from your email.  If you can't click on it in the email, you'll have to select and copy it from the email.  Then paste it into your browser, into the place you would type the address of any other webpage. Technical details: The token '%s' wasn't found."), $q_t));
    }
    $P = person_get($d['email']);
    if (is_null($P)) {
        $P = person_get_or_create($d['email'], $d['name']);
    }
    $P->inc_numlogins();
    db_commit();
    /* Now give the user their cookie. */
    set_login_cookie($P);
    RedirectToOriginalDest($d['stash']);
    /* NOTREACHED */
}
$P = person_if_signed_on();
if (!is_null($P)) {
    RedirectToOriginalDest($q_stash);
    /* NOT REACHED */
} else {
    $action = strtolower(get_http_var('action', 'login'));
    if ($action == 'login') {
function do_reallycreate()
{
    $email = get_http_var('email', '');
    $name = get_http_var('name', '');
    $person = person_get($email);
    if ($person) {
        ?>
<div class="action_error">
Already an account with that email address.<br/>
see <a href="/adm/useraccounts?person_id=<?php 
        echo $person->id();
        ?>
">here</a>.
</div>
<?php 
        return;
    }
    $person = person_get_or_create($email, $name);
    db_commit();
    ?>
<div class="action_summary">
New account created.
</div>
<?php 
    emit_details($person->id());
}