Skip to content

Instantly share code, notes, and snippets.

@andandehei
Created October 29, 2014 14:16
Show Gist options
  • Save andandehei/31a6eab514272ba3fa2b to your computer and use it in GitHub Desktop.
Save andandehei/31a6eab514272ba3fa2b to your computer and use it in GitHub Desktop.
wordpress教程:wordpress忘记密码后重置用户名及密码
<?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