MagicalDean
Technical User
This is a bit of code I have to administrate a text file based comment system on my site:
$file = "./shouts.txt";
$fp = fopen($file, "r+");
rewind($fp);
fwrite($fp,$shout);
fclose($fp);
The shouts.txt file exists and is editable, ie has the right CHMOD values. But is there any way I can delete the entire contents of the file first, and then have it write in $shout. Sorry if this is kinda confusing, but any help is greatly apprechiated!
$file = "./shouts.txt";
$fp = fopen($file, "r+");
rewind($fp);
fwrite($fp,$shout);
fclose($fp);
The shouts.txt file exists and is editable, ie has the right CHMOD values. But is there any way I can delete the entire contents of the file first, and then have it write in $shout. Sorry if this is kinda confusing, but any help is greatly apprechiated!