$i++;
            }
            $database->query("UPDATE " . TABLE_PREFIX . "users SET password = '******', last_reset = '" . time() . "' WHERE user_id = '" . $results_array['user_id'] . "'");
            if ($database->is_error()) {
                // Error updating database
                $message = $database->get_error();
            } else {
                // Setup email to send
                $mail_to = $email;
                $mail_subject = $MESSAGE['SIGNUP2_SUBJECT_LOGIN_INFO'];
                // Replace placeholders from language variable with values
                $search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
                $replace = array($results_array['display_name'], WEBSITE_TITLE, $results_array['username'], $new_pass);
                $mail_message = str_replace($search, $replace, $MESSAGE['SIGNUP2_BODY_LOGIN_FORGOT']);
                // Try sending the email
                if ($admin->mail(SERVER_EMAIL, $mail_to, $mail_subject, $mail_message)) {
                    $message = $MESSAGE['FORGOT_PASS_PASSWORD_RESET'];
                    $display_form = false;
                } else {
                    $database->query("UPDATE " . TABLE_PREFIX . "users SET password = '******' WHERE user_id = '" . $results_array['user_id'] . "'");
                    $message = $MESSAGE['FORGOT_PASS_CANNOT_EMAIL'];
                }
            }
        }
    } else {
        // Email doesn't exist, so tell the user
        $message = $MESSAGE['FORGOT_PASS_EMAIL_NOT_FOUND'];
        // and delete the wrong Email
        $email = '';
    }
} else {
Beispiel #2
0
    }
}
// end include class.secure.php
global $TEXT;
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/html; charset:utf-8;");
// not needed, config is loaded with class.secure
// include realpath(dirname(__FILE__)).'/../../config.php';
include realpath(dirname(__FILE__)) . '/../../framework/class.admin.php';
$admin = new admin('Settings', 'settings_basic');
$curr_user_is_admin = in_array(1, $admin->get_groups_id());
if (!$curr_user_is_admin) {
    echo "<div style='border: 2px solid #CC0000; padding: 5px; text-align: center; background-color: #ffbaba;'>You're not allowed to use this function!</div>";
    exit;
}
$settings = array();
$sql = 'SELECT `name`, `value` FROM `' . TABLE_PREFIX . 'settings`';
if ($res_settings = $database->query($sql)) {
    while ($row = $res_settings->fetchRow()) {
        $settings[strtoupper($row['name'])] = $row['name'] != 'wbmailer_smtp_password' ? htmlspecialchars($row['value']) : $row['value'];
    }
}
ob_clean();
// send mail
if ($admin->mail($settings['SERVER_EMAIL'], $settings['SERVER_EMAIL'], 'LEPTON PHP MAILER', $TEXT['WBMAILER_TESTMAIL_TEXT'])) {
    echo "<div style='border: 2px solid #006600; padding: 5px; text-align: center; background-color: #dff2bf;'>", $TEXT['WBMAILER_TESTMAIL_SUCCESS'], "</div>";
} else {
    $message = ob_get_clean();
    echo "<div style='border: 2px solid #CC0000; padding: 5px; text-align: center; background-color: #ffbaba;'>", $TEXT['WBMAILER_TESTMAIL_FAILED'], "<br />{$message}<br /></div>";
}