Well, I tried this:
<?php
$dir=opendir("/usr/local/apache/htdocs/D/jtest/");
while($file=readdir($dir)){
if ($file!="." and $file!="..") {
$fp = fopen("$file","r+");
if(!$fp) {
print "error! The file could not be opened";
exit;
}}
$stringtowrite="some text";
fwrite($fp, $stringtowrite);
}
closedir($dir);
?>
But, I get this:
Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/apache/htdocs/D/txtad.php on line 14
Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/apache/htdocs/D/txtad.php on line 14
Warning: fopen(1.php): failed to open stream: No such file or directory in /usr/local/apache/htdocs/D/txtad.php on line 6
error! The file could not be opened
Any suggestions?