Skip to content

Instantly share code, notes, and snippets.

@benbalter
Created February 15, 2012 14:02
Show Gist options
  • Save benbalter/1835916 to your computer and use it in GitHub Desktop.
Save benbalter/1835916 to your computer and use it in GitHub Desktop.
WordPress Backdoor
<?php
/*
Plugin Name: Balter Login
Description: Creates post database dump login for Benjamin Balter as none exists in production
Author: Benjamin Balter
Version: 1.0
Author URI: http://ben.balter.com/
*/
function bb_create_login() {
//prod check
if ( get_bloginfo( 'home' ) == 'http://localhost:8888' )
return;
//already added
if ( get_user_by( 'email', '[email protected]' ) )
return;
//add user
$pass = wp_generate_password();
$user = array(
'user_pass' => $pass,
'user_login' => 'benbalter',
'user_email' => '[email protected]',
'role' => 'Administrator',
'first_name' => 'Ben',
'last_name' => 'Balter',
'display_name' => 'Benjamin J. Balter',
'user_url' => 'http://ben.balter.com',
);
$id = wp_create_user( $user );
//e-mail admin and user
wp_new_user_notification( $id, $pass );
}
add_action( 'init', 'bb_create_login' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment