Looking forward to what you come up with…
My previous response was a bit curt as I was getting ready for a major project activation and really didn’t have any time available. Long time ago, I used a script like this before I started using a Wiki for my newer websites and can just edit the pages using its control.
Below is a PHP script I threw together from one of those to do a simple file editor and display function.
How it works…
To output the data on your page, you just call the script with no arguments. It will read the text file, and then output some pre and post CSS with the contents of the file in between.
You can of course just point to the text file and use it directly.
Editing the File
To edit the file, you use the script with ?cmd on the end like:
When you do this, it then looks to see if you have logged in during the current session. If not, it will prompt you for the password. If entered in correctly, it will set a session variable, and let you use a “really simple” editor of the file. Each time you click on submit, it will replace the contents of the file with what is in the text box.
The password is set in the script, and you will need to change it because it needs to be 10 characters or less (it is currently much longer to force you to change it).
Note… there is no SSL involved so logging in is in plain text.
Example of Edit Mode:
and, no… the password in the displayed source is not the same in the active file. So unless you can guess the password, you won’t be able to actually edit.
This could be expanded to let you online choose the file and display the file etc… but this is very simple.
No .htaccess control is needed.