> I am trying to delete all text in a file.
> $yourfile = "file.txt";
> $fp = fopen($yourfile,w)
> "is there any good code to put in here?"
> fclose($fp);

You should check that $fp is valid.

    if (!$fp){
        echo "Unable to empty $yourfile<BR>\n";
    }

But pretty much, the fopen($yourfile, 'w') is going to make the file be
empty.

NOTE:
If you are doing this for security reasons, that doesn't mean that a *real*
hacker can't have some sort of tool to dig into random bytes of the hard
drive and see what used to be in the file...  But any user that has that
much access to your web server probably has more interesting things to do to
mess you up...

Still, there may be better ways to wipe the data itself out if it's
particularly sensitive.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to