Re: How are variables called in current php?
| From: | Jason Sheets | Date: | Mon, 15 Sep 2003 04:13:12 +0000 |
| Subject: | Re: How are variables called in current php? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162593@lists.php.net to get a copy of this message | ||
Looks like that code depends on register globals being enabled which have been off for some time. You can either turn register globals on in php.ini (not recommended) or with an .htaccess file (better than using php.ini not as good as changing the code if that is possible).
Information about all three of these is available at http://www.php.net/manual/en
If you own the code you can use $_SERVER['REQUEST_METHOD'].
Jason
Wei Wang wrote:
hi, all, I have a piece of code stuck at the point of "if (($REQUEST_METHOD=='post'))". "var_dump($REQUEST_METHOD);" shows that the variable doesn't exist. Since I grabbed the code from a 2001 update, is there any chance that this is already obsolete? I checked the documentation but didn't find anything relevant. Any advice would be highly appreciated. ;-) The following is the complete code that I got stuck at if (($REQUEST_METHOD=='post')) { //////////////////////////////// // This loop removed "dangerous" characters from the posted data // and puts backslashes in front of characters that might cause // problems in the database. //////////////////////////////// for(reset($HTTP_POST_VARS);$key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) {$this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, ">", " "); $this = strtr($this, "<", " "); $this = strtr($this, "|", " "); $$key = $this; } else { print ('Boo, I never got executed'); }//apparently the script never make it to this point And add appriopriateassigments at the top of your script.