Jump to content

php text file editor web page and file security


dcell59
Go to solution Solved by ignace,

Recommended Posts

I'm just getting started with WP and php, but I'm an old school Unix programmer. I found some code that will allow me to create a page that works kind of like the WP theme file editor. I want to be able to load up a text file, display it in an edit field on a form, and then when the user hits the submit button, the server will back up the old file contents and write the new data into the file. Pretty simple.

 

My problem is that I want to be able to keep people from viewing and modifying the files from the web site. I can secure the web page so that only specified roles can access the page, but if someone can guess the path to my text file on the server, they can read it (and possibly write it?). How do I prevent this, while still allowing my php code on the WP page to read and write the file?

 

(PS, in the long run, I'll probably put the data in the database so I don't have to worry about this, but I'm hoping there's an easy solution to get me going.)

Thanks!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.