if($file =@ fopen("$fname","r")){
$content = fread($file, filesize($fname));
echo $content;
$content2 = eregi_replace("(username)", $user, $content);
fclose($file);
}
else
echo "<br> Cannot open file to read";
echo "<br><br><br>", $content2;
if($fp =@ fopen("$fname","w")){
fwrite($fp, $content2);
fclose($fp);
}
else
echo "<br> Cannot open file to write";
?>
This code opens the file for reading successfully, but it cannot open the file to write back the changes made. Anybody know why?