Try this there was white space in the code.
These are examples they are not 100% perfect its to give you an idea how to make it work with your form i am not here to make code for you.
There are place for that on the net that you pay for.
[php]<?php
$data = ‘config.php’;
/* if nothing has been posted print to screen */
if(!isset($_POST[‘submit’])&&(!isset($_POST[‘oldusername’]))&&(!isset($_POST[‘newusername’])) && (!isset($_POST[‘oldpassword’])) && (!isset($_POST[‘newpassword’]) ) ){
?>
FIND
Replace
FIND
Replace
<?php
}
?>
<?php
/* if form has been posted && and filled out */
if(isset($_POST['submit']) && (isset($_POST['oldusername'])) && (isset($_POST['newusername']) ) && (isset($_POST['oldpassword'])) && (isset($_POST['newpassword']) ) ){
// post the data to be replaced
$old = '$config[\'admin_username\'] = "'.$_POST['oldusername'].'";';
$new = '$config[\'admin_username\'] = "'.$_POST['newusername'].'";';
$oldpass = ‘$config[‘admin_password’] = "’.$_POST[‘oldpassword’].’";’;
$newpass = ‘$config[‘admin_password’] = "’.$_POST[‘newpassword’].’";’;
/* // Get a file to change$data = ‘config.php’; /
if(file_exists($data)){
/ // change the content with the posted content */
if( $content = file_get_contents($data)){
}
file_put_contents( $data, str_replace(trim($oldpass), trim($newpass), $content));
echo ‘file has been modified’;
if( $content = file_get_contents($data)){
file_put_contents( $data, str_replace(trim($old), trim($new), $content));
}
}else{
echo 'Error no file to wirte to';
}
}else{
echo 'Error POST not set';
}
?>[/php]
config.php
[php]<?php
$config[‘admin_username’] = “admin”;
$config[‘admin_password’] = “password”;
?>[/php]