Hello, Im trying to build a CMS which outputs three php pages using fwrite.
The code starts off by writing three text files, then after the main page has loaded it attempts to write a new php page. This error message keeps occuring when attempting to create the new file...
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\AppacheFriends\xampplite\htdocs\xampp\CMS\install.php on line 129
Here is the suspect code...
<?php
$filename="index.php";
$file = fopen( $filename, "w");
fwrite( $file, "
<?php
#assign environment variable values
$address = $SERVER['REMOTE_ADDR'];
$referer = $SERVER['HTTP_REFERER'];
$browser = $_SERVER['HTTP_USER_AGENT'];
#Open the log file
$file = fopen("log.txt", "a");
#write the time of access
$time = date("H:i dS F");
fwrite($file, "<b>Time:</b> $time<br>" );
if( $address != null)
{ fwrite($file,"<b>IP Address:</b> $address<br>");}
if( $referer != null)
{ fwrite($file,"<b>Referer</b> $referer<br>");}
fwrite($file,"<b>Browser:</b> $browser<p></p></p></p>");
fclose($file);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <?php
$myFile = "name.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 710);
fclose($fh);
echo $theData;
?></title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:575px;
height:1518px;
z-index:1;
left: 259px;
top: -1px;
background-color: #FFCC99;
}
.style1 {
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #990000;
font-weight: bold;
}
body {
background-color: #CCCCCC;
background-image: url(Background.jpg);
}
#Layer1 {
border-top-width: thin;
border-right-width: thin;
border-bottom-width: thin;
border-left-width: thin;
border-top-style: none;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-top-color: #000000;
border-right-color: #000000;
border-bottom-color: #000000;
border-left-color: #000000;
}
-->
</style>
</head>
<body>
<div id="Layer1">
<p><img src="Title.jpg" alt="Title Image" width="575" height="123"/></p>
<blockquote>
<p><span class="style1"><a href="index.php">News</a> | <a href="archive.php">Archived </a></span>
</p><hr/>
<p class="style1">
<?php
$myFile = "news.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 710);
fclose($fh);
echo $theData;
?>
</p>
</blockquote>
</div>
</body>
</html>
");
fclose( $file );
?>
Any Help Would be appreciated! thanx