<?php
 
 
 
session_start();
 
 
try{
 
    $tmpName = "./output/settings.php";
 
 
    $template = file_get_contents("./sourceData/settings.php");
 
    $template = str_replace("#server#", $_POST['server'],$template);
 
    $template = str_replace("#database#", $_POST['database'],$template);
 
    $template = str_replace("#user#", $_POST['user'],$template);
 
    $template = str_replace("#password#", $_POST['password'],$template);
 
 
    file_put_contents($tmpName, $template);
 
 
    $_SESSION['msg'] = "Settings file generated succesfully";
 
}
 
catch(Exception $e){
 
    $_SESSION['msg'] = "Error saving the settings file ";
 
}
 
 
header("Location: ./");
 
die();
 
 
 
?>
 
 |