if (isset($_POST['submit']) && $_POST['newline']) { $handle=fopen($path,"w"); $contents .= . stripslashes(trim($_POST['newline'])) . ; fwrite($handle, $contents) or exit('error writing to file'); fclose($handle); }
i want to overwrite whats in $path whats the letter for it
It is 'w'.
What is the value of $contents? because you are using '.=' ?
This line: $contents .= . stripslashes(trim($_POST['newline'])) . ;
Should perhaps be changed to:
$contents = stripslashes(trim($_POST['newline']));
hth.
<?php $path = 'xfire.txt'; $contents = file_get_contents($path); if (isset($_POST['submit']) && $_POST['newline']) { $handle=fopen($path,"w"); $contents .= stripslashes(trim($_POST['newline'])); fwrite($handle, $contents) or exit('error writing to file'); fclose($handle); } echo ' <html> <head><title>Xfiresigs v1.0.1 Administration</title> </head> <body> <center> <form action="" method="POST"> <br> To remove usernames and errors remove their line of code. <br> <textarea width="800px" height="400px" style="width:800px;height:400px" name="newline">'; include('xfire.txt'); echo ' </textarea> <br> <input type="submit" name="submit" value="submit"> </form> </center> <br> <br> <br> <br> <!--Please dont remove the following!--!> <center><font size="1">Xfiresigs copyright <a href="http://www.gac-online.com">=(GaC)=</a></font></center> </body> </html>'; ?>
So if you want to overwrite what's in $path, there's not much point reading it all in so that you end up writing it all out again:
$contents = file_get_contents($path);