Пример #1
0
<?php

$aid = $user->aid;
$user = new AccountUser();
$user->find_by_aid((int) $aid);
if (!$user->unsetcookie()) {
    err_not_found();
}
header("Location: login.phtml?message=" . urlencode("You have been logged out"));
Пример #2
0
$successes = array("create", "email", "forgot_password");
if (!isset($_REQUEST['cookie'])) {
    err_not_found('No cookie');
}
$cookie = $_REQUEST['cookie'];
$pending = db_query_first("select * from u_pending where cookie = ?", array($cookie));
if (!$pending) {
    if (isset($cookie) && !empty($cookie)) {
        $error = "unknown";
        $tpl->set_var("COOKIE", $cookie);
    } else {
        err_not_found('No cookie');
    }
} else {
    $user = new AccountUser();
    $user->find_by_aid((int) $pending['aid']);
    if (!$user->valid()) {
        $error = "invalid_aid";
    } else {
        db_exec("update u_pending set status = 'Done' where tid = ?", array($pending['tid']));
        switch ($pending['type']) {
            case "NewAccount":
                if ($user->status == 'Create') {
                    $user->status("Active");
                    if (!$user->update()) {
                        $error = "activate_failed";
                    } else {
                        $success = "create";
                    }
                } else {
                    $success = "create";