You can try something along these lines:
PHP Code:
<?php // Make a MySQL Connection $localhost = preg_replace('/[^0-9a-z\.\-_]/i','',$_POST['localhost']); $db_u = preg_replace('/[^0-9a-z\.\-_]/i','',$_POST['db_u']); $db_p = preg_replace('/[^0-9a-z\.\-_]/i','',$_POST['db_p']); $db = preg_replace('/[^0-9a-z\.\-_]/i','',$_POST['db']); if (!empty($localhost) && !empty($db_u) && !empty($db_p) && !empty($db) ) { mysql_connect($localhost, $db_u, $db_p) or die(mysql_error()); mysql_select_db($db) or die(mysql_error()); //The rest of your code here } else { //The user did not fill in all values, so show an error message. }
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|