遇到忘记密码应该是常事;不过经常使用的也能忘,就容易让人见笑了!
忘了就忘了呗~咱想个办法重设一下,动手吧!
<?php
include('wp-config.php');
include('wp-blog-header.php');
$to_check = "http://jokerliang.com";
$default_password = '$P$Bdhc5gWxRrprI3UGzASM.HsDbGlAvB/'; //admin
if (empty($_POST['emergency_pass'])) {
?>
<form method='post'>
重设管理员(admin)密码:
<input name='emergency_pass' type='password' />
<input name='check_str' type='text' />
<input name="type" type="radio" value="1" checked="checked" />输入新密码
<input name="type" type="radio" value="0" />恢复成"admin"
<input type='submit' />
</form>
<?php
} else {
if( isset( $_POST['check_str'] ) && trim ( stripslashes( $_POST['check_str'] ) ) == $to_check ) {
$new_password = ( $_POST['type'] ) ? md5( stripslashes( $_POST['emergency_pass'] ) ) : $default_password;
$sql = 'UPDATE '.$wpdb->users.' SET user_pass = "'. $new_password .'" WHERE User_login = "admin"';
$result = $wpdb->query($sql);
wp_redirect('wp-login.php');
exit();
}
}
?>
将上面的代码存成pass-reset.php.
Continue reading 重设wordpress密码的最实用方法