コード例 #1
0
ファイル: passreset.inc.php プロジェクト: hky/bytehoard
            # Send the email with the new password
            # Email them about it with the validation link
            $emailobj = new bhemail($emailaddr);
            $emailobj->subject = str_replace("#SITENAME#", $bhconfig['sitename'], $bhlang['emailsubject:passreset_new_password']);
            $emailobj->message = str_replace("#PASSWORD#", $newpass, $bhlang['email:passreset_new_password']);
            $emailaway = $emailobj->send();
            if ($emailaway == false) {
                # Open layout object
                $layoutobj = new bhlayout("generic");
                # Send the file listing to the layout, along with directory name
                $layoutobj->title = $bhlang['title:signup'];
                $layoutobj->content1 = "<br><br>" . $bhlang['error:email_error'];
                $layoutobj->display();
            } else {
                # Update the database with it.
                bh_auth_set_password($resetrows[0]['username'], $newpass);
                # Open layout object
                $layoutobj = new bhlayout("generic");
                # Send the file listing to the layout, along with directory name
                $layoutobj->title = $bhlang['title:signup'];
                $layoutobj->content1 = "<br><br>" . $bhlang['notice:passreset_new_password_sent'];
                $layoutobj->display();
            }
        }
    }
} else {
    # Open layout object
    $layoutobj = new bhlayout("passreset");
    # Send the file listing to the layout, along with directory name
    $layoutobj->title = $bhlang['title:recover_password'];
    $layoutobj->content1 = $bhlang['explain:recover_password'];
コード例 #2
0
ファイル: options.inc.php プロジェクト: hky/bytehoard
    header("Location: ../index.php");
    die;
}
# See if there's an incoming password change
if (!empty($_POST['changepass'])) {
    $changepass = $_POST['changepass'];
    # Check the old password is correct
    $oldcheck = bh_authenticate($bhsession['username'], $changepass['old']);
    if ($oldcheck == TRUE) {
        # See if the two new passwords match
        if ($changepass['new'] == $changepass['new2']) {
            # If they're using a blank password, warn them, but don't stop them
            empty($changepass['new']) ? bh_log($bhlang['warning:blank_password'], "BH_WARNING") : null;
            # OK, update their password.
            # (That's 5 Es, btw. Got to make this a bit more challenging. Wait till I use MD5sums as names)
            $reeeeesult = bh_auth_set_password($bhsession['username'], $changepass['new']);
            # And give them heaps of praise. Or tell them bad things have happened.
            if ($reeeeesult == TRUE) {
                bh_log($bhlang['notice:password_changed'], "BH_NOTICE");
            } else {
                bh_log($bhlang['error:unknown'], "BH_NOTICE");
            }
        } else {
            # They've been bad.
            bh_log($bhlang['error:passwords_dont_match'], "BH_ERROR");
        }
    } else {
        # Tell them what they did wrong
        bh_log($bhlang['error:old_password_invalid'], "BH_ERROR");
    }
}