Re: executeing another files code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



M. Sokolewicz wrote:
Marek Kilimajer wrote:

Ryan A wrote:

Hey all,
Heres my problem, I have this written in "email.fff"
############# Start file ##########
Hi $firstname $lastname,
We have recieved your request for support.

We will get back to you shortly.
Regards,
$sitename

P.S below is the message you submitted:
$message
############# End file ##########

Question is:
How can I get the file in my php script and fill in those variables then
send the above email message.
I know how to open a file via fread/file I now how to do the mail() etc...
Just a little confused....



Don't execute it, it's expensive. Simply read the file in a string and replace all occurences that you need:


$s = str_replace(
    array('$firstname', '$lastname', '$sitename', '$message'),
    array($firstname, $lastname, $sitename, $message),
    $s);

actually, as far as I see, that should be equally expensive as eval()'ing it :)

eval has to look for more tokens and is less secure.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux