[pLog-svn] Re: AdminLoginAction
Jon Daley
plogworld at jon.limedaley.com
Wed Mar 22 12:20:39 GMT 2006
On Tue, 21 Mar 2006, Jesse Peterson wrote:
>> It doesn't matter, does it? There can't be both of them in the same
>> request :-)
>
> Sure there can. You can send a send an HTTP POST to a URL like:
> http://example.com/example.php?myparam=value. In raw PHP you grab the
> URL param from $_GET and the POST param from $_POST.
>
> Unless I'm completely wrong - which wouldn't surprise me :).
You (Jesse) are correct. When I code stuff I put the POST in
higher precedence above the GET, because POSTs are a little harder to
hack.
Here is a function I use all the time, and then never access $_GET
or $_SERVER, etc. directly.
function getHttpVar($type, $name, $default){
if($type == "GET"){
if(isset($_GET[$name])){
return jd_escape_string($_GET[$name]);
}
}
else if($type == "POST"){
if(isset($_POST[$name]))
return jd_escape_string($_POST[$name]);
}
else if($type == "EITHER"){
if(isset($_POST[$name])){
return jd_escape_string($_POST[$name]);
}
else if(isset($_GET[$name])){
return jd_escape_string($_GET[$name]);
}
}
return $default;
}
More information about the pLog-svn
mailing list