I’ve created a file with fopen as so
$string = '<?php
define ("DB_HOST", "'. $_POST["dbhost"]. '");
define ("DB_USER", "'. $_POST["dbuname"]. '");
define ("DB_PASS","'. $_POST["dbpass"]. '");
define ("DB_NAME","'. $_POST["dbname"]. '")
?>';
$confile = "../lib/con.php";
if (!file_exists($confile)) {
$fp = fopen($confile, "x") or die("can't open file ".$confile);
fwrite($fp, $string);
fclose($fp);
} else {
$fp = fopen($confile, "w") or die("can't open file ".$confile);
fwrite($fp, $string);
fclose($fp);
}
However now if I try to download the file using Dreamweaver or Filezilla it won’t download the file unless I rename it. Can anyone work out what I may be doing wrong here?
Con in a web server sense is considered a reserve, to some web hosts, and that when writing to a file named con, it sometimes fail, if you rename the the file to conn.php it should work.