[PHP] Cannot read variables
Hello, I just set up a test box for PHP/MySQL on a WinXP box and now I'm having trouble with variables passed to browser from a link. For example I have a link that outputs this: http://localhost/index.php?team=CF10b. Now the CF10b cannot be user in the code like it should. I turned to Register Globals on in the php.ini but that didn't help. Any ideas? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot read variables
On Tue, 6 Jun 2006 10:36:12 +0300, you wrote: I just set up a test box for PHP/MySQL on a WinXP box and now I'm having trouble with variables passed to browser from a link. For example I have a link that outputs this: http://localhost/index.php?team=CF10b. Now the CF10b cannot be user in the code like it should. I turned to Register Globals on in the php.ini but that didn't help. Any ideas? Most likely you didn't turn RG on (typo? wrong php.ini?), or didn't restart. Try: print_r ($_POST); print_r ($_GET); print_r ($_REQUEST); to see if your variable is being passed. If it is, PHP isn't set up as you want it. If it isn't, there's something more fundamental wrong. -- http://www.otton.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot read variables
Yess! Wrong ini file... There seems to be 3 of them on the same PC for some reason? -W David Otton [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] On Tue, 6 Jun 2006 10:36:12 +0300, you wrote: I just set up a test box for PHP/MySQL on a WinXP box and now I'm having trouble with variables passed to browser from a link. For example I have a link that outputs this: http://localhost/index.php?team=CF10b. Now the CF10b cannot be user in the code like it should. I turned to Register Globals on in the php.ini but that didn't help. Any ideas? Most likely you didn't turn RG on (typo? wrong php.ini?), or didn't restart. Try: print_r ($_POST); print_r ($_GET); print_r ($_REQUEST); to see if your variable is being passed. If it is, PHP isn't set up as you want it. If it isn't, there's something more fundamental wrong. -- http://www.otton.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot read variables
William Stokes wrote: Yess! Wrong ini file... There seems to be 3 of them on the same PC for some reason? -W David Otton [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] On Tue, 6 Jun 2006 10:36:12 +0300, you wrote: I just set up a test box for PHP/MySQL on a WinXP box and now I'm having trouble with variables passed to browser from a link. For example I have a link that outputs this: http://localhost/index.php?team=CF10b. Now the CF10b cannot be user in the code like it should. I turned to Register Globals on in the php.ini but that didn't help. Any ideas? Most likely you didn't turn RG on (typo? wrong php.ini?), or didn't restart. Try: print_r ($_POST); print_r ($_GET); print_r ($_REQUEST); to see if your variable is being passed. If it is, PHP isn't set up as you want it. If it isn't, there's something more fundamental wrong. -- http://www.otton.org/ Turn off register globals. Now. It is a HUGE security hole. You do NOT need it turned on to use $_GET or the other superglobals, and there is in fact no reason at all to EVER turn it on. The only conceivable reason that someone would enable it is for an old badly written script, and in that case one has to question why they are running an old badly written script :) Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot read variables
Adam Zey wrote: ... http://www.otton.org/ Turn off register globals. Now. It is a HUGE security hole. it is NOT by definition a security hole - the problem arises from scripts that don't bother to initialize all their variable before using them, which allows blackhats to possibly interfere with the intended functionality of a script. e.g. ? // myfile.php if (chkCleanRequired()) { $delete = true; } if ($delete) doDeleteRoutines(); ? which could be hacked like so (if register_globals was on): somedomain.tld/myfile.php?delete=1 that said having register_globals turned on is bad practice - turning it off and using $_GET, $_POST and $_REQUEST is preferred and offers a buffer against silly mistakes related to not initializing variables properly ... in addition a number of members of the core php dev team are in the process of finalizing a data filtering extension [which I believe will be included in php by default] that will take data filtering to a whole other level in php ... soon even the use of the raw data in $_POST, $_GET, et al will be discouraged in favor of using the api provided by the filter extension... I'm so looking forward to that :-) You do NOT need it turned on to use $_GET or the other superglobals, and there is in fact no reason at all to EVER turn it on. The only conceivable reason that someone would enable it is for an old badly written script, and in that case one has to question why they are running an old badly written script :) there are plenty of legacy codebases out there that rely on register_globals AND are quite adequate regarding protection from potential problems arising from register_globals being turned on. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot read variables
On Tue, June 6, 2006 2:36 am, William Stokes wrote: I just set up a test box for PHP/MySQL on a WinXP box and now I'm having trouble with variables passed to browser from a link. For example I have a link that outputs this: http://localhost/index.php?team=CF10b. Now the CF10b cannot be user in the code like it should. Perhaps because you used 'team' and not 'user'... echo $_GET['team'] should work for you. I turned to Register Globals on in the php.ini but that didn't help. Any ideas? As said before, turn them back OFF! -- 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