Exemplo n.º 1
0
/**
* Reset the password for a user
* @param none
*/
function reset_password()
{
    global $db;
    global $conf;
    $data = CmnFns::cleanPostVals();
    $password = empty($data['password']) ? $conf['app']['defaultPassword'] : stripslashes($data['password']);
    $db->reset_password($data['memberid'], $password);
    if (isset($data['notify_user'])) {
        send_pwdreset_email($data['memberid'], $password);
    }
    CmnFns::write_log('Password reset by admin for user ' . $_POST['memberid'], $_SESSION['sessionID']);
    print_success();
}
Exemplo n.º 2
0
$rc = $member['ResultCode'];
if (!isset($rc) || $rc != 0) {
    header("location: pwdreset1.php?id=3");
    exit;
}
$token = $member['token'];
if (!isset($token)) {
    die('no token');
}
$url = "https://account.thewarinc.com/pwdreset2.php?token={$token}";
$body = "Someone from {$Last_IP} requested password reset to War Inc. Battlezone\n";
$body .= "If it wasn't you please disregard this message\n";
$body .= "\n";
$body .= "Otherwise please visit the following link {$url} to set your new password\n";
$subject = "Your password reset link to War Inc. Battlezone";
if (send_pwdreset_email($email, $body, $subject)) {
    header("location: pwdreset1.php?id=1");
    exit;
} else {
    header("location: pwdreset1.phpid=2");
    exit;
}
function send_pwdreset_email($email, $body, $subject)
{
    require_once 'PHPMailer_v5.1/class.phpmailer.php';
    $mail = new PHPMailer(true);
    // the true param means it will throw exceptions on errors, which we need to catch
    try {
        $mail->IsSMTP();
        // telling the class to use SMTP
        $mail->SMTPDebug = 1;