Revision 799
Added by doc over 17 years ago
| save.php | ||
|---|---|---|
| 226 | 226 |
set_error('Please enter a database name', 'database_name');
|
| 227 | 227 |
} else {
|
| 228 | 228 |
// make sure only allowed characters are specified |
| 229 |
if(preg_match('/[^a-z0-9_]+/i', $_POST['database_name'])) {
|
|
| 229 |
if(preg_match('/[^a-z0-9_-]+/i', $_POST['database_name'])) {
|
|
| 230 | 230 |
// contains invalid characters (only a-z, A-Z, 0-9 and _ allowed to avoid problems with table/field names) |
| 231 |
set_error('Only characters a-z, A-Z, 0-9 and _ allowed as database name.', 'database_name');
|
|
| 231 |
set_error('Only characters a-z, A-Z, 0-9, - and _ allowed in database name.', 'database_name');
|
|
| 232 | 232 |
} |
| 233 | 233 |
$database_name = $_POST['database_name']; |
| 234 | 234 |
} |
| 235 | 235 |
// Get table prefix |
| 236 | 236 |
if(preg_match('/[^a-z0-9_]+/i', $_POST['table_prefix'])) {
|
| 237 | 237 |
// contains invalid characters (only a-z, A-Z, 0-9 and _ allowed to avoid problems with table/field names) |
| 238 |
set_error('Only characters a-z, A-Z, 0-9 and _ allowed as table_prefix.', 'table_prefix');
|
|
| 238 |
set_error('Only characters a-z, A-Z, 0-9 and _ allowed in table_prefix.', 'table_prefix');
|
|
| 239 | 239 |
} else {
|
| 240 | 240 |
$table_prefix = $_POST['table_prefix']; |
| 241 | 241 |
} |
| ... | ... | |
| 350 | 350 |
} |
| 351 | 351 |
|
| 352 | 352 |
// Try to create the database |
| 353 |
mysql_query('CREATE DATABASE '.$database_name);
|
|
| 353 |
mysql_query('CREATE DATABASE `'.$database_name.'`');
|
|
| 354 | 354 |
|
| 355 | 355 |
// Close the mysql connection |
| 356 | 356 |
mysql_close(); |
Also available in: Unified diff
allowed character "-" to be used in database names