Richard Davey wrote:
Hi Stut,

Tuesday, June 19, 2007, 1:16:54 PM, you wrote:

The problem is finding a way to expand the input name (which is a
string) into a format that $_POST can be searched for. Or do the
reverse, iterate through $_POST to find a match for the input name and
get that value.

Try this overly commented snippet on for size...
http://dev.stut.net/php/davey.php

Very nice, thank you. I was hoping there would be a way to do it
without resorting to eval(), but if even you can't figure out how, I'm
not going to waste any more time trying to either :)

You probably could by breaking it into each part and then using a loop to descend to the right place, but I don't think that's going to be any better than using eval.

I'm assuming the source for $target is trusted. If not then you'll want to sanitise it further by removing anything that's not a-z, 0-9 and [] just to ensure no dodgy code can be inserted.

I loved this part:

// The target - offensive American spelling!

:)

Cheers,

No probs.

-Stut

--
http://stut.net/

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

Reply via email to