Validate Table Prefix in wp-config.php generator. Props johnl1479. Fixes #12622

git-svn-id: http://svn.automattic.com/wordpress/trunk@13853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-03-28 01:57:45 +00:00
parent 8c6fb6f8ec
commit 7bafa5ee43
1 changed files with 6 additions and 1 deletions

View File

@ -157,7 +157,12 @@ switch($step) {
$passwrd = trim($_POST['pwd']);
$dbhost = trim($_POST['dbhost']);
$prefix = trim($_POST['prefix']);
if (empty($prefix)) $prefix = 'wp_';
if ( empty($prefix) )
$prefix = 'wp_';
// Validate $prefix: it can only contain letters, numbers and underscores
if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );
// Test the db connection.
/**#@+