Hi, I am trying to create a script that creates other php scripts but I am getting a problem, when I create the file and use fwrite() to write to it, it returns an error saying: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\setup2.php on line 32. Lines 28 - 62 of my script are:
-
touch("$folder_install/display_emails.php");
-
if ($fp_display_emails=fopen("$folder_install/display_emails.php", "w")) {
-
fwrite($fp_display_emails,stripslashes("<?php
-
session_start();
-
if ($_SESSION[\'logged_in\'] != 1) {
-
header (\"Location: index.php\");
-
}
-
$conn=mysql_connect(\"".$mysql_server."\", \"".$mysql_username."\", \"".$mysql_password."\");
-
mysql_select_db(\"".$mysql_database_name."\",$conn);
-
$sql=\"SELECT * FROM list\";
-
$result=mysql_query($sql,$conn);
-
echo \"<table border=1 cellpadding=5>\";
-
while ($newArray=mysql_fetch_array($result)) {
-
$id = $newArray[\'id\'];
-
$firstname = $newArray[\'firstname\'];
-
$email = $newArray[\'email\'];
-
echo \"
-
<tr>
-
<td>
-
<font face=\'arial\'>$id.</font>
-
</td>
-
<td>
-
<font face=\'arial\'>\".ucfirst(strtolower($firstname)).\"</font>
-
</td>
-
<td>
-
<font face=\'arial\'>\".strtolower($email).\"</font>
-
</td>
-
</tr>
-
\";
-
}
-
echo \"</font></table>\";
-
mysql_close($conn);
-
?>"));
-
echo "The file display_emails.php was created!<br>";
-
}
-
Please help me, I am not even sure if you are allowed to create scripts inside scripts?
Line 32:
- if ($_SESSION[\'logged_in\'] != 1) {
(This is inside the fwrite() function)