WordPress.org

Make WordPress Core

Changeset 13853


Ignore:
Timestamp:
03/28/10 01:57:45 (5 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/setup-config.php

    r13837 r13853  
    158158    $dbhost  = trim($_POST['dbhost']); 
    159159    $prefix  = trim($_POST['prefix']); 
    160     if (empty($prefix)) $prefix = 'wp_'; 
     160    if ( empty($prefix) ) 
     161        $prefix = 'wp_'; 
     162 
     163    // Validate $prefix: it can only contain letters, numbers and underscores  
     164    if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )  
     165        wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ );  
    161166 
    162167    // Test the db connection. 
Note: See TracChangeset for help on using the changeset viewer.