I am making an install script for a website I'm working on, I'm having troubles making the scripts that generates the config.php file. Here is how I'm generating the string for the config file:
<?php
if (file_exists("config.php")) {
header("Location: index.php");
} else {
if (isset($_POST['smtp_password'])) {
if (!($configFile = fopen("config.php", "c"))) {
print("ERROR: Cannot write in this directory!");
exit();
}
$config = <<<EOT
<?php
$_AMCFG['login_dir'] = '{$_POST['login_dir']}'; /* LINE 12 */
$_AMCFG['server_key'] = '{$_POST['server_key']}';
$_AMCFG['host'] = '{$_POST['host']}';
$_AMCFG['database'] = '{$_POST['database']}';
$_AMCFG['user'] = '{$_POST['user']}';
$_AMCFG['password'] = '{$_POST['password']}';
$_AMCFG['smtp_name'] = '{$_POST['smtp_name']}';
$_AMCFG['smtp_mail'] = '{$_POST['smtp_mail']}';
$_AMCFG['smtp_host'] = '{$_POST['smtp_host']}';
$_AMCFG['smtp_port'] = {$_POST['smtp_port']};
$_AMCFG['smtp_user'] = '{$_POST['smtp_user']}';
$_AMCFG['smtp_password'] = '{$_POST['smtp_password']}';
?>
EOT;
fwrite($configFile, $config);
$db = mysqli_connect($_POST['host'], $_POST['user'], $_POST['password']);
mysqli_select_db($db, $_POST['database']);
$sqlFile = file_get_contents("install.sql");
mysqli_multi_query($sqlFile);
mysqli_query($db, "INSERT INTO admins (steamid, name, mail, disabled, superadmin) VALUES (\"".escape($_POST['admin_steamid'])."\", \"".escape($_POST['admin_name'])."\", \"".escape($_POST['admin_email'])."\", 0, 1)");
}
}
?>
And here is the error I get in return: (line #12)
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
What am I doing wrong?