Forum Moderators: coopster

Message Too Old, No Replies

editing php file from frontend of website

         

indiguy

12:01 pm on Sep 27, 2009 (gmt 0)

10+ Year Member



Hi,

im wondering:
i can edit sql db fields from the frontend,
i can specify options in html (<select><option>...)
But,
in a php file (contact.php) in the mail("blah@blah.com", $subject, $message, $from);
If i do this:

mail($emailadd, $subject, $message, $from);
can i do this?

$emailadd = htmlentities(strip_tags($_POST[" "]));

thats where im stuck. Im aware these a fopen in php, but has this ever been done.. im setting it up for the manager to be able to change the email address if need to in future.. (self managed website) or should i just make a db table, and manage it like that?

cameraman

2:36 pm on Sep 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, you can do that. Unless the manager wants to type it in every time you'd want to store it somewhere, whether it's in a db table or in a file. If you use a file and only store the address in it, you can use file_get_contents [us.php.net] to retrieve it pretty easily (see its companion, file_put_contents, for writing). You'd want to secure the page somehow, to keep unwanted changes from happening. If you don't want to do a full-blown authentication system, at least hard-code a password that has to be matched in order to make the change.