I am trying to make my script install a config file with the right settings so the it can be used by anyone. Here is the file that will create the config file:
<?php
$dbhost = $_POST["dbhost"];
$dbuser = $_POST["dbuser"];
$dbpass = $_POST["dbpass"];
$dbname = $_POST["dbname"];
$location = $_POST["location"];
$configfile = "<?php
/**
* @Blood 08
* @copyright 2008
*/
//
//Setting Database
//Begin
\$dbhost = '".$dbhost."';
\$dbuser = '".$dbuser."';
\$dbpass = '".$dbpass."';
\$conn = mysql_connect(\$dbhost, \$dbuser, \$dbpass) or die (mysql_errno());
\$dbname = '".$dbname."';
mysql_select_db(\$dbname);
//End
//Setting Database
//
//
//Setting Include Path
//Begin
ini_set(\"include_path\", \".:../:./include:../include\");
//End
//Setting Include Path
//
?>";
$ourFileName = $location."config.inc.php";
$ourFileHandle = fopen($location.'config.inc.php', 'w') or die("Couldn't Create file");
fwrite($ourFileHandle, $configfile);
fclose($ourFileHandle);
header( 'Location: '.$location.'install/install.php?page=dbsetup' ) ;
?>
$location is equal to: $url
$direct = dirname($_SERVER['SCRIPT_NAME']);
$direct2 = dirname($direct);
$url = "http://".$_SERVER['HTTP_HOST'].$direct2."/";
I already have config.inc.php in the correct directory and after I run this script I get no errors, but when I look at config.inc.php there is nothing written in it???