PHP Classes

File: generateSettings.php

Recommend this page to a friend!
  Classes of Martijn Waeyenbergh   PHP MySQL Generator   generateSettings.php   Download  
File: generateSettings.php
Role: Application script
Content type: text/plain
Description: generate the Settings File
Class: PHP MySQL Generator
Generate classes to access MySQL database tables
Author: By
Last change:
Date: 2 years ago
Size: 642 bytes
 

Contents

Class file image Download
<?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();


?>