if you have a template:, store it in a string,
$connect='<?php
/// For the following details,
/// please contact your server vendor
$hostname=\'***1\'; //// specify host, i.e. \'localhost\'
$user=\'****2\'; //// specify username
$pass=\'****3\'; //// specify password
$dbase=\'****4\'; //// specify database name
$connection = mysql_connect($hostname , $user , $pass)
or die ("Can\'t connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can\'t select database.");
?>';
then create a form to ask these 4 values from the user,
and use the str_replace to add to this string the values.
$connect=str_replace('***1', htmlspecialchars($_POST["hostname"]),$connect);
$connect=str_replace('***2', htmlspecialchars($_POST["username"]),$connect);
ect...
If you know well sprintf then use its features to create this $connect string
if the user add to this form php codes, then the htmlspecialchars will change the special characters.
then use the fopen and fwrite to create the connect.php.
after this save, lets delete this install_database.php
if you ready with your code, but don't really sure its safe or not, i suggest that you might post into this forum.
as foyer told
data submitted by a user can be very harmful to ones server.