Re: Re: HTTP_POST_VARS and eval?
| From: | Henrik Hudson | Date: | Sat, 17 Nov 2001 04:42:54 +0000 |
| Subject: | Re: Re: HTTP_POST_VARS and eval? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74814@lists.php.net to get a copy of this message | ||
Thanks for the help on this.
The file it's reading in:
-----------------------------------------
An example form has been submitted.
Name: ]name[
Email: ]email[
The user made the following comments:
]comments[
Just in case we forget, the users name is ]name[ and their email is ]email[
----------------------------------------------
The output of the code:
-----------------------------------------------
Line: An example form has been submitted.
Lineafterwards: An example form has been submitted.
Line:
Lineafterwards:
Line: Name: $HTTP_POST_VARS["name"]
Lineafterwards: Name: $HTTP_POST_VARS["name"]
Line: Email: $HTTP_POST_VARS["email"]
Lineafterwards: Email: $HTTP_POST_VARS["email"]
Line:
Lineafterwards:
Line:
Lineafterwards:
Line: The user made the following comments:
Lineafterwards: The user made the following comments:
Line: $HTTP_POST_VARS["comments"]
Lineafterwards: $HTTP_POST_VARS["comments"]
Line:
Lineafterwards:
Line:
Lineafterwards:
Line:
Lineafterwards:
Line: Just in case we forget, the users name is $HTTP_POST_VARS["name"] and
their email is $HTTP_POST_VARS["email"]
Lineafterwards: Just in case we forget, the users name is
$HTTP_POST_VARS["name"] and their email is $HTTP_POST_VARS["email"]
-----------------------------------------------------
On Thursday 15 November 2001 18:20, Richard Lynch wrote:
> Henrik Hudson wrote:
> > So, its having problems doing an eval on the HTTP_POST? If I replace the
> > HTTP_POST stuff with just $\\1 and then define $string =
> > $HTTP_POST_VARS["string"] it works just fine, but I can't do this since I
> > don't know what string is going to be, just that it is between ] [ chars
> > and
> > there can be multiple ] [ on one line.
> >
> > Any thoughts? Code is below.
> >
> > //Read the array
> > $form_data = "";
> > for($i=0; $i < count($filearr); $i++){
> > $line = $filearr[$i];
> > //Strip the ] [ from around the variables so they will be
> > interpreted $line = eregi_replace("\]([^\[]+)\[",
> > "\$HTTP_POST_VARS['\\1']",
> > $line);
> > echo "Line: $line<BR>";
> > //eval the variables from $line into themselves and they become
> > literal
> > eval ("\$line = \"$line\";");
> > echo "Lineafterwards: $line<BR>\n";
> > //Write the line back into a single variable
> > $form_data = $form_data . $line;
> > }
> > exit;
>
> Show use the output, espeically the debugging output of what the lines say
> that you are trying to eval....
--
Henrik Hudson
lists@rhavenn.net