RE: [PHP] Variable Inside Variable

2002-04-20 Thread Jeff Oien

 On Fri, 19 Apr 2002, Jeff Oien wrote:
  Far better would be to put a placeholder in $body like  and then just 
  do $body = ereg_replace('', $url, $body);
  
  That's giving me a blank also. The form for changing the email is in a 
  password protected area where only two people are allowed. But I'll
  implement the more secure version when I can get it to work. Thanks
  for the help.
 
 If that's giving you a blank then something else is wrong in your code.  
 This definitely does work:
  
$body = Hello, and thank you. Please visit the site .;
$url = http://boogers.on.toast/;;
$body = ereg_replace('', $url, $body);
 
 Start from the simplest case, verify that it works, and then work out to
 include all the other funky stuff you've got going on.
 
 miguel

What I meant was this is giving me a blank still:
$body = eval(return \{$body}\;);
Just to clarify. I will be trying to narrow down the problem later today.
Jeff Oien 

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




Re: [PHP] Variable Inside Variable

2002-04-19 Thread Jason Wong

On Friday 19 April 2002 09:31, Jeff Oien wrote:
 I have a script which retrieves the body of an email message from
 a MySQL database to be sent to someone who applies using a form.
 The script contains this:

 $url = a
 href=\http://$HTTP_HOST$SCRIPT_NAME\;http://$HTTP_HOST$SCRIPT_NAME/a;
 $url = addslashes($url);

 $msg1 .= $body; //to be sent via mail()

 Then within the body of the message I want $url to show up.
 The body of the message in the database looks like this:
 ---
 You are receiving this exclusive message to confirm your
 application through $url.
 ---
 I've tried everything I can think of with $url, curly brackets, backslashes
 etc. What am I missing? Thanks.

Use eval().

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
A grammarian's life is always in tense.
*/

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




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Jeff Oien

 On Friday 19 April 2002 09:31, Jeff Oien wrote:
  I have a script which retrieves the body of an email message from
  a MySQL database to be sent to someone who applies using a form.
  The script contains this:
 
  $url = a
  href=\http://$HTTP_HOST$SCRIPT_NAME\;http://$HTTP_HOST$SCRIPT_NAME/a;
  $url = addslashes($url);
 
  $msg1 .= $body; //to be sent via mail()
 
  Then within the body of the message I want $url to show up.
  The body of the message in the database looks like this:
  ---
  You are receiving this exclusive message to confirm your
  application through $url.
  ---
  I've tried everything I can think of with $url, curly brackets, backslashes
  etc. What am I missing? Thanks.
 
 Use eval().

I have $url (literally) embedded in some text in the database that is to be 
sent as an email message. I'm using this and $url disappears with a blank
spot in the text:
eval(\$body = \$body\;);
I've tried variations and can't get it to work. Any help? Thanks.
Jeff Oien

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




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Jeff Oien wrote:
 Use eval().
 
 I have $url (literally) embedded in some text in the database that is to be 
 sent as an email message. I'm using this and $url disappears with a blank
 spot in the text:
 eval(\$body = \$body\;);
 I've tried variations and can't get it to work. Any help? Thanks.

While you could do something like:

  $body = eval(return \{$body}\;);

...the huge, monstrous, gigantic problem is that if you allow anyone to 
edit any part of $body or any string that goes into it, you are basically 
handing them control of your server, because they can get eval() to 
execute any code they want.

Far better would be to put a placeholder in $body like  and then just 
do $body = ereg_replace('', $url, $body);

miguel


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




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Jeff Oien

 On Fri, 19 Apr 2002, Jeff Oien wrote:
  Use eval().
  
  I have $url (literally) embedded in some text in the database that is to be 
  sent as an email message. I'm using this and $url disappears with a blank
  spot in the text:
  eval(\$body = \$body\;);
  I've tried variations and can't get it to work. Any help? Thanks.
 
 While you could do something like:
 
   $body = eval(return \{$body}\;);
 
 ...the huge, monstrous, gigantic problem is that if you allow anyone to 
 edit any part of $body or any string that goes into it, you are basically 
 handing them control of your server, because they can get eval() to 
 execute any code they want.
 
 Far better would be to put a placeholder in $body like  and then just 
 do $body = ereg_replace('', $url, $body);
 
 miguel

That's giving me a blank also. The form for changing the email is in a 
password protected area where only two people are allowed. But I'll
implement the more secure version when I can get it to work. Thanks
for the help.
Jeff Oien 

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




RE: [PHP] Variable Inside Variable

2002-04-19 Thread Miguel Cruz

On Fri, 19 Apr 2002, Jeff Oien wrote:
 Far better would be to put a placeholder in $body like  and then just 
 do $body = ereg_replace('', $url, $body);
 
 That's giving me a blank also. The form for changing the email is in a 
 password protected area where only two people are allowed. But I'll
 implement the more secure version when I can get it to work. Thanks
 for the help.

If that's giving you a blank then something else is wrong in your code.  
This definitely does work:
 
   $body = Hello, and thank you. Please visit the site .;
   $url = http://boogers.on.toast/;;
   $body = ereg_replace('', $url, $body);

Start from the simplest case, verify that it works, and then work out to
include all the other funky stuff you've got going on.

miguel


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