Posted by Michael Fesser on 07/25/07 09:06
..oO(Robin)
>The ternary conditional operator comes in handy here, so your original
>function call:
>
>htmlspecialchars(stripslashes($_POST["blabla"]), ENT_QUOTES);
>
>becomes
>
>htmlspecialchars(get_magic_quotes_gpc()?stripslashes($_POST["blabla"]):$_POST["blabla"],ENT_QUOTES);
I would rather put that into a function:
function getPostData($name) {
if (isset($_POST[$name])) {
return get_magic_quote_gpc()
? stripslashes($_POST[$name])
: $_POST[$name];
} else {
return NULL;
}
}
Or something like that.
Micha
[Back to original message]
|