Пример #1
0
        $t->assign('messages', $msg);
        $t->assign('captchaHtml', Securimage::getCaptchaHtml());
        $t->display('register.tpl');
        die;
    } else {
        return true;
    }
}
/**
 * Determines whether or not to show to sign-up form
 * based on whether the form has been submitted, if it
 * has, check the database for consistency and create
 * the new account.
 */
if (isset($_POST['subjoin'])) {
    if (checkSubmitValues()) {
        /* Add the new account to the database */
        $_SESSION['username'] = $_POST['user'];
        $_SESSION['password'] = md5($_POST['pass']);
        $_SESSION['reguid'] = addNewUser(trim($_POST['user']), trim($_POST['pass']), trim($_POST['email']));
        $_SESSION['registered'] = true;
        header('Location: ' . $CFG->wwwroot . '/modules/frontpage/frontpage.php');
        return;
    }
    // Otherwise will fall through to show the form, with the error set.
} else {
    if (isset($_GET['confirm'])) {
        if (confirmRegistration($_GET['confirm'])) {
            $t->assign('message', 'Thank you for confirming your registration.');
            $t->display('registerConfirm.tpl');
            die;
Пример #2
0
    global $showErr;
    /* Make sure at least one field was entered */
    if (!$_POST['user']) {
        $showErr = 'Please provide a valid username.';
        return FALSE;
    }
    /* Check if username is valid */
    $email = checkUser($_POST['user']);
    if (!$email) {
        $showErr = 'Sorry, the username: "******" could not be found.';
        return FALSE;
    }
    // If we get here, username is valid. Return the email address.
    return $email;
}
/* If a request has been submitted, handle it.  */
if (isset($_POST['subreq'])) {
    $email = checkSubmitValues();
    if ($email) {
        $newPW = synthesizeAndUpdatePassword($_POST['user']);
        sendPWMail($_POST['user'], $email, $newPW);
        $t->assign('message', "Your password has been updated, and the new password will be mailed to the email account associated to your account.");
        $t->display('forgotpw.tpl');
        die;
    }
}
$t->assign('message', "{$showErr}");
$t->display('forgotpw.tpl');
?>