<?php
if ( !isset($_GET['create']) )
	die('pass <strong>?create=1</strong> to this URL to create a whole bunch of users for your blog');
include('admin.php');


$fn = array(
	'john', 'mary', 'clyde', 'mark', 'david', 'stephen', 'thomas', 'tom', 'joseph', 'derrik', 'authur', 'chester', 'michael', 'mike', 'bambi', 'maxim', 'max', 'amelia', 'maria', 'bill', 'william', 'robert', 'bob', 'bobby', 'rob', 'cain', 'frasier', 'ross', 'phoebe', 'joey', 'jesse', 'adam', 'eve', 'jesus', 'matthew', 'matt', 'colby', 'ryan', 'trent', 'marina', 'julie'
	);

$ln = array(
	'smith', 'jones', 'jaquith', 'mullenweg', 'schlussman', 'howland', 'macy', 'grossman', 'reznor', 'lee', 'woods', 'imperioli', 'hart', 'shurbet', 'jolie', 'pitt', 'schwimmer', 'boren', 'pinkovich', 'malcovich', 'wesson', 'hays'
	);



$em = array(
	'aol.com', 'gmail.com', 'hotmail.com', 'yahoo.com', 'verizon.com', 'comcast.net', 'cox.net', 'rr.com'
	);



$authors = array();

foreach ( $fn as $f ) {
	foreach ( $ln as $l ) {
		$authors[] = array('user_login' => $f . $l, 'user_email' => $f . $l . '@' . $em[rand(0, count($em) - 1)], 'user_pass' => md5(rand() . rand() . microtime()) );
	}
}

$inserted_ids = array();

if ($_GET['create']) {
	$first_id = 0;
	foreach ( $authors as $author ) {
		$inserted = wp_insert_user($author);
		if (!$first_id) $first_id = $inserted;
		else $last_id = $inserted;
	}
}

if ( $inserted ) {
	$first_id--;
	$last_id++;
	echo "<p>New users were inserted into your database.  In order to get rid of them, you need to run the SQL queries below.  <strong>COPY THIS DOWN NOW!</strong></p>";
	echo "<hr />";
	echo "<p>DELETE FROM <?php echo $wpdb->users; ?> WHERE ID < $last_id AND ID > $first_id;</p>";
	echo "<p>DELETE FROM <?php echo $wpdb->usermeta; ?> WHERE user_id < $last_id AND user_id > $first_id;</p>";
}
?>