Security/$_REQUEST vars... How do you do it?
| From: | Michael Hulse | Date: | Sat, 03 Dec 2005 22:14:39 +0000 |
| Subject: | Security/$_REQUEST vars... How do you do it? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-226820@lists.php.net to get a copy of this message | ||
Hello,
This is my first time posting to the list... I hope this question is not too silly, I am definitely not a guru at PHP.
Anyway, in one of my latest projects, I find myself using this bit of code quite a bit:
if((isset($_REQUEST['sub'])) && (!empty($_REQUEST['sub']))) {
... code here...
}
Can I write a function that would make my life easier? Maybe something like this (not tested):
//////// function security_check():
function security_check($x) {
$error = false;
if((isset($x)) && (!empty($x))) {
$error = false;
return $error;
} else {
$error = true;
return $error;
}
}
Or, is it perfectly valid and secure to use @, like so:
@... code here...
I know that it completely depends on the what one is trying to accomplish in ones scripts, but any guidance and/or suggestions would be greatly appreciated.
Thanks, I really appreciate your time.
Cheers,
Micky
--
¸.·´¯
·.¸¸><(((º>·.¸¸.·´¯`·.¸¸><((((º>
·´¯·.¸¸.·´¯·.¸¸.·´¯·.¸¸.·´¯·..¸¸><((((º>
·.¸><((((º>¸.·´¯·.¸¸><((((º>