I have used the snippet that you gave me but, I have changed this:
while ($contents=readdir($handle))
to this:
while (false !== ($file = readdir($handle)))
and also I added the closedir() function at the end.
and now, the parse error is gone. But, now i got errors stating that
Warning: fopen(0.txt): failed to open stream: Permission denied in c:\inetpub\wwwroot\openclosedir.php on line 21
which is this line:
$fp = fopen($new_file, "a");
Warning: fputs(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\openclosedir.php on line 23
which is this line:
$write = fputs($fp, $string);
and,
Warning: fclose(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\openclosedir.php on line 24
which is this line:
fclose($fp);
I guess something is wrong when it tries to execute the fopen().
Any idea how I could make this work??
This is the whole part of it...
$new_file = "$new_name.txt";
$fp = fopen($new_file, "a");
$string = "$qseq";
$write = fputs($fp, $string);
fclose($fp);