140513 wordpress最快速的重置密码方法

wordpress目录下新建个reset.php,代码如下

<?php
//password resetter
include("wp-config.php");
include("wp-blog-header.php");
if (empty($_POST['emergency_pass'])) {
?>
<form method="post">
set admin password: <input name="emergency_pass" type="password" />
<input type="submit" />
</form>
<?php
} else {
$sql = "UPDATE ".$wpdb->users." SET user_pass = '".md5($_POST['emergency_pass'])."' WHERE User_login = 'admin'";
$link = $wpdb->query($sql);
wp_redirect('wp-login.php');
exit();
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注