I'm trying to write to a file using
$fp = fopen( $filename, "w" ) or die("Couldn't open $filename");
fwrite( $fp, "" )
Everything works fine when writing simple text but when i try to write a javascript to the file using this method, i get a parse error on the link <script language="javascript">.
I think that this line is getting mixed up with the php and trying to process it but i dont know how to stop it from doing that.
I've included the entire code that i'm trying to execute:
<?php
$filename = "test.html";
print "Writing to $filename<br>";
$fp = fopen( $filename, "w" ) or die("Couldn't open $filename");
fwrite( $fp, "
<head>
<title><!--PROGRAM NAME-->.com</title>
</head>
<body>
<script language="javascript">
var currentdate = 0
var theranlink = " "
var core = 0
function StringArray (n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ' '
}
}
link = new StringArray(3)
link[0] = 'URL'
link[1] = 'URL'
link[2] = 'URL'
var ran = 60/link.length
function ranlink() {
currentdate = new Date()
core = currentdate.getSeconds()
adcore = Math.floor(core/ran)
core = adcore
theranlink = link[core]
self.location = theranlink
}
document.write("<a href='javascript:ranlink()'></a>")
var URL = "javascript:ranlink()"
var speed = 0000
function reload() {
location = URL
}
setTimeout("reload(1)", speed);
</script>
</body>
" );
fclose( $fp );
?>
P.S. I appreciate your help! Thank you.
Jeff...