Re: Check if $_GET contains something other than what's allowed [message #183821 is a reply to message #183820] |
Thu, 21 November 2013 21:31 |
Salvatore
Messages: 38 Registered: September 2012
Karma:
|
Member |
|
|
On 2013-11-21, Jason C <jwcarlton(at)gmail(dot)com> wrote:
> Just for the sake of peace of mind, how can I check for any $_GET key
> that's not allowed (in which case I can kill the script from the
> beginning)?
$allowed_values = array('username', 'password', ...);
foreach ($_GET as $key => $value) {
if (array_search($key, $allowed_values) === false) {
// deny access here
}
}
--
Blah blah bleh...
GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++
|
|
|