13-11-09, 12:32
|
# 9
|
|
:
:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
dbhost: <input type="text" name="dbhost" /> <br />
dbuser: <input type="text" name="dbuser" /> <br />
dbpass: <input type="password" name="dbpass" /> <br />
dbname: <input type="text" name="dbname" /> <br />
<input type="submit" name="install" value="install" />
</form>
<?php
if(isset($_POST['install'])){
$file = "config.php";
file_get_contents($file);
$edit = '
<?php
$dbhost = "'.$_POST['dbhost'].'";
$dbuser = "'.$_POST['dbuser'].'";
$dbpass = "'.$_POST['dbpass'].'";
$dbname = "'.$_POST['dbname'].'";
mysql_connect($dbhost,$dbuser,$dbpass)or die(mysql_error());
mysql_select_db($dbname)or die(mysql_error());
?>';
file_put_contents($file,$edit);
}
?>
|
|
|
|