>I am having a problem with php4 and a get url.  For instance the URL:
>I have a script which does a foreach through all the _GET vars:
>foreach ($_GET as $var => $value)
>This peice works fine except that when the var (name) has a period in it
>that is changed to a _.  If the value has a period it is not changed to _.
>I have snooped the packets and it is sent to the server as '.'  Is this a
>server (apache) issue or a php issue.  Is there anything I can do.

It's a PHP thing.

Same thing will trip you up if you use <INPUT TYPE=IMAGE NAME=image> which
sends image.x and image.y, but you can't have variable names with '.' in
them, so PHP changes them to $image_x and $image_y

(Only now with register_globals off, it doesn't :-^)

If you *really* need the original data, put a phpinfo() in front of your
foreach loop and reload the URL (or re-POST the form or whatever).

Do a search (control-F or whatever) for the 'test1.test.com' in that mess. 
(Search again to see all your choices for extracting your data -- It will be
in there a few times, some easier to use than others.)

At least one of those variables is going to have the information you need.

Rule of Thumb:  Any time your data ain't what you want it to be, throw in
phpinfo() and see what you've got :-)

I can see where you'd expect $_GET to have array keys with '.' in them,
since that's kosher, but if/when register_globals is on, it's kinda critical
to have the keys match up with the variable names, or folks will get real
confused, real fast...

The data you need is just in some other less convenient variable, but it's

Might be $REQUEST_URI or something like that.  But phpinfo() will tell you
for sure.

Hope that all makes sense...

If register_globals were completely abolished forever everywhere no matter
what, then I suppose it does get kinda silly that array keys, where '.' is
perfectly acceptable, get converted into '_' instead...  But, there it is,
and it ain't gonna change any time soon. :-)

Like Music?  http://l-i-e.com/artists.htm

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

Reply via email to