I am trying to access my php script and replace a link that is in the script with a new link. I know the basics of fopen and fwrite, but I don't know how to get the code to overwrite a specific line in my code. Thanks, Keegan
You cannot just overwrite 1 line. Make a script that loads the other script in a textarea box. edit it, and click the submit button. The code for submit could be: $data= $_POST[textarea_code]; if (get_magic_quotes_gpc()) { $data=stripslashes($data); } $f= fopen('file.php', 'w'); fwrite($f, $data); fclose($f); Code (markup): That's a basic code with no security/required checks, but I'm sure you can develop on it. The stripslash is done to remove any \ that your server might have added to the posted data based on server settings. Thanks
If you want it done without your writing anything, read the file and write out a new file. When you get to the line with the link write the new link, not the old one. Then delete the original file and rename the new one to the old name.