Hi,
I have used this code to make a php file with php code in it:
<?php
$fn = 'connect.inc.php';
$string = "<?php
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_password = '';
$mysql_database = 'main';
@mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("There was an error connecting to the server");
@mysql_select_db($mysql_database) or die("There was an error connecting to the table");
?>";
if ($handle = fopen($fn, 'w')){
if (!fwrite($handle, $string)){
die("Couldn't write to file");
echo "Writing success";
}
}
?>
However, the code inside the variable string gets executed but I don't want this to happen. How to tell php to avoid executing it?
Thanks in advance,
Nahiyan