F.J Kong's Blog

BRAVO HOTEL ONE SIERRA CHARLIE WHISKEY

How to reset your wordpress password

After a long time, I found I totally forget password of my wordpress, then I resolved it with this:

save it to your wordpress directory and open it  in browser. after reset your password REMEMBER to delete it.

<?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();
}
?>

Leave a Reply