Created
October 29, 2014 14:16
-
-
Save andandehei/31a6eab514272ba3fa2b to your computer and use it in GitHub Desktop.
wordpress教程:wordpress忘记密码后重置用户名及密码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment