$value) { if(!$value && $key != 'db_pass') { echo '
'.$key.' is required
';; die; } } echo 'Connection successful.
'; } else { echo 'ERROR! Connection unsuccessful.
'; die; } //make sure the db exissts $db_exists = mysql_select_db($_POST["db_name"], $connect); if($db_exists) { echo 'Database exists.
'; } else { echo 'ERROR! Could not select database.
'; die; } //make sure tables do not exist $tables = select("SHOW TABLES"); //tables I want are PREFIX.images //PREFIXvotes foreach($tables as $table) { if($table["Tables_in_".$_POST["db_name"]] == $_POST["table_prefix"].'images') { echo 'ERROR! Tables already exist. Exiting.
'; die; } elseif($table["Tables_in_".$_POST["db_name"]] == $_POST["table_prefix"].'votes') { echo 'ERROR! Tables already exist. Exiting.
'; die; } } echo 'Writing config file...'; $cfile = file_get_contents('../config.inc.php'); if(strlen($ccfile) > 0) { echo ' ERROR! Config file exists.
'; } include("write-config.php"); echo ' done.'; echo 'Installation finished. Redirecting to home page in ... 5 seconds
'; echo ''; ?>