I am looking for a ways to open a document, in this case the code below is the output of a function I wrote. Within this output I get access to some additional files I would like to edit, in this case the css files.
Can I get ideas of how to open/edit them once I click on them?
<tr>
<td class="form_select"><input id="select_all_form15" name="select_all_form15" type="checkbox" value="Forms" class="case" /></td>
<td class="form_id">1334261250</td>
<td class="form_url"><a href="/forms/hatternet/deland/email/index.php" target="_blank">Lifetime Email Request</a></td>
<td class="form_autofill">HATTERNET</td>
<td class="form_save">form.css</td>
<td class="form_save"></td>
<td class="form_save"></td>
<td class="form_save"></td>
<td class="form_dates"></td>
</tr>
You’re going to need an additional script to handle this, but the function you’re looking for to read an entire file from disk to a variable is:
Docs are here: https://www.php.net/manual/en/function.file-get-contents.php
and: https://www.php.net/manual/en/function.file-put-contents.php
You’ll then have to output the contents of the file being edited to a textarea so that you can edit it, and then when you post the changes back, you’ll have to write them to the file again.
However, using this technique, you MUST be extremely careful, it’s possible to completely screw yourself over. You need to restrict file editing only to the files you actually want users to edit. So if it’s only style.css that should be editable, make sure that your script can only read and write to that file and nothing else.
You’ll also need to make sure there’s some sort of authentication in front of this script so that other people can’t make changes to your website.