note 117650 deleted from reserved.variables.get by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:58:16 +0000 |
| Subject: | note 117650 deleted from reserved.variables.get by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210844@lists.php.net to get a copy of this message | ||
Note Submitter: dirk dot lze at gmail dot com
----
Make $_GET and $_POST more like in Perl.
This function also disable magic_quotes.
Will be better to handle.
function param($name){
if(is_string($name)){
if((bool) get_magic_quotes_gpc()){
set_magic_quotes_runtime(0);
$param = isset($_POST[$name]) ? stripslashes($_POST[$name]) : false;
$param = isset($_GET[$name]) ? stripslashes($_GET[$name]) : $param;
}else{
$param = isset($_POST[$name]) ? $_POST[$name] : false;
$param = isset($_GET[$name]) ? $_GET[$name] : $param;
}
return $param;
}else{
return $name;
}
}
if(param('foo')){
echo "bar";
}