Skip to content

Instantly share code, notes, and snippets.

@fritids
Forked from andandehei/password-resetter.php
Last active August 29, 2015 14:09
Show Gist options
  • Save fritids/55d2362d2bee0c75083e to your computer and use it in GitHub Desktop.
Save fritids/55d2362d2bee0c75083e to your computer and use it in GitHub Desktop.
<?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