Is it possible to edit a php file from itself?

566 views Asked by At

Is it possible to edit a php file from itself? I would like to have a php file that a user can log into with their e-mail address and password then give them a several fields they can edit. Upon submitting their entries the actual php file they used to submit info is updated.

Lets say there are three fields displayed once logged in... 1. Email (can not be read when rendered in a browser or via source code) 2. Password (can not be read when rendered in a browser or via source code) 3. Textarea (contents you submit in the textarea would be visible if you load page in browser, in addtion, a blank username and password field would be visible in a browser, so the owner could login to edit the file)

With this system the user would be able to edit their login information and change information displayed on the page when viewed through a browser. Using the email in the file I guess I could include a sendmail function should they forget their password.

Is this possible. If so, does anyone know of a simple script that I can use to get started?

1

There are 1 answers

11
Austin Collins On

You are are better off storing the information you want to change in another PHP file. Then loading/editing it on request.

Editing the file you are using can cause issues. You could also loose all of your code if something is injected that corrupts the formatting code.