Interesting... You should check out the 'eval' function:

http://www.php.net/manual/en/function.eval.php

This can be used to evaluate a string as if its PHP code. Its tricky to use, so you will probably have to do a bit of trial and error, but the required code would look something like this:

// you want something like this: $foo = "bar";
$php_to_eval = "\$" . addslashes($key) .
" = \"" . addslashes($value) "\";";
eval($php_to_eval);

You'll need to be VERY careful with $key and $value... make sure it doesn't contain any quotes by using addslashes()... otherwise you just opened up a hacker hole.

Read the comments to the documentation at the bottom of the URL above. There's lots of people giving useful tips and tricks...

--

Brian 'Bex' Huff
[EMAIL PROTECTED]
Phone: 952-903-2023
Fax: 952-829-5424


I was wondering how I can loop over the QUERY_STRING server variable to
make all the get variables into a localized variables. I know it has
something to do with setting the variable using a double $$? is that
correct?
/*localize url vars */
$urlQuery_string = explode("&", $_SERVER['QUERY_STRING']);
for ($i=0; $i < count($urlQuery_string); $i++) {
$keyvalue = explode("=", $urlQuery_String[$i]);
/* ok now what? */
}




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

Reply via email to