Revision 1770
Added by Dietmar about 12 years ago
save.php | ||
---|---|---|
201 | 201 |
set_error('Please enter a database host name', 'database_host'); |
202 | 202 |
} else { |
203 | 203 |
$database_host = $_POST['database_host']; |
204 |
} |
|
205 |
// Check if user has entered a database username |
|
206 |
if(!isset($_POST['database_username']) OR $_POST['database_username'] == '') { |
|
207 |
set_error('Please enter a database username','database_username'); |
|
208 |
} else { |
|
209 |
$database_username = $_POST['database_username']; |
|
210 |
} |
|
211 |
// Check if user has entered a database password |
|
212 |
if(!isset($_POST['database_password'])) { |
|
213 |
set_error('Please enter a database password', 'database_password'); |
|
214 |
} else { |
|
215 |
$database_password = $_POST['database_password']; |
|
216 |
} |
|
204 |
} |
|
217 | 205 |
// Check if user has entered a database name |
218 | 206 |
if(!isset($_POST['database_name']) OR $_POST['database_name'] == '') { |
219 | 207 |
set_error('Please enter a database name', 'database_name'); |
220 | 208 |
} else { |
221 | 209 |
// make sure only allowed characters are specified |
222 |
if(preg_match('/[^a-z0-9_-]+/i', $_POST['database_name'])) {
|
|
210 |
if(!preg_match('/^[a-z0-9_-]*$/i', $_POST['database_name'])) {
|
|
223 | 211 |
// contains invalid characters (only a-z, A-Z, 0-9 and _ allowed to avoid problems with table/field names) |
224 | 212 |
set_error('Only characters a-z, A-Z, 0-9, - and _ allowed in database name.', 'database_name'); |
225 | 213 |
} |
226 | 214 |
$database_name = $_POST['database_name']; |
227 | 215 |
} |
228 | 216 |
// Get table prefix |
229 |
if(preg_match('/[^a-z0-9_]+/i', $_POST['table_prefix'])) {
|
|
217 |
if(!preg_match('/^[a-z0-9_]*$/i', $_POST['table_prefix'])) {
|
|
230 | 218 |
// contains invalid characters (only a-z, A-Z, 0-9 and _ allowed to avoid problems with table/field names) |
231 | 219 |
set_error('Only characters a-z, A-Z, 0-9 and _ allowed in table_prefix.', 'table_prefix'); |
232 | 220 |
} else { |
233 | 221 |
$table_prefix = $_POST['table_prefix']; |
234 | 222 |
} |
235 | 223 |
|
224 |
// Check if user has entered a database username |
|
225 |
if(!isset($_POST['database_username']) OR $_POST['database_username'] == '') { |
|
226 |
set_error('Please enter a database username','database_username'); |
|
227 |
} else { |
|
228 |
$database_username = $_POST['database_username']; |
|
229 |
} |
|
230 |
// Check if user has entered a database password |
|
231 |
if(!isset($_POST['database_password'])) { |
|
232 |
set_error('Please enter a database password', 'database_password'); |
|
233 |
} else { |
|
234 |
$database_password = $_POST['database_password']; |
|
235 |
} |
|
236 |
|
|
236 | 237 |
// Find out if the user wants to install tables and data |
237 | 238 |
$install_tables = ((isset($_POST['install_tables']) AND $_POST['install_tables'] == 'true')); |
238 | 239 |
// End database details code |
Also available in: Unified diff
WbDatabase::getTableEngine() changed SQL statement to strikt.
! remove empty warning box if you aren't sysadmin
! change order errorhandling in installation save.php
! Framework/frontend.functions.php change file_exists to is_readable