Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #11894

Re: Check if $_GET contains something other than what's allowed

From Salvatore <sal@yojimbo.hack.invalid>
Newsgroups comp.lang.php
Subject Re: Check if $_GET contains something other than what's allowed
Date 2013-11-21 21:31 +0000
Organization Yojimbo NNTP server
Message-ID <l6lu43$1tsi$1@news.tokachu.com> (permalink)
References <2c0d0971-a336-4691-9113-01d1f854d2f4@googlegroups.com>

Show all headers | View raw


On 2013-11-21, Jason C <jwcarlton@gmail.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++

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Check if $_GET contains something other than what's allowed Jason C <jwcarlton@gmail.com> - 2013-11-21 13:21 -0800
  Re: Check if $_GET contains something other than what's allowed Salvatore <sal@yojimbo.hack.invalid> - 2013-11-21 21:31 +0000
  Re: Check if $_GET contains something other than what's allowed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-21 22:48 +0100
    Re: Check if $_GET contains something other than what's allowed Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-21 17:16 -0500
      "Hackers" vs. "Crackers" (was: Re: Check if $_GET contains something other than what's allowed) Arno Welzel <usenet@arnowelzel.de> - 2013-11-22 17:36 +0100
        Re: "Hackers" vs. "Crackers" Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-22 13:52 -0500
          Re: "Hackers" vs. "Crackers" j80k-vpfc@dea.spamcon.org (Steve) - 2013-11-30 11:49 +0000
            Re: "Hackers" vs. "Crackers" Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-30 08:53 -0500
              Re: "Hackers" vs. "Crackers" j80k-vpfc@dea.spamcon.org (Steve) - 2013-11-30 14:58 +0000
                Re: "Hackers" vs. "Crackers" Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-30 10:15 -0500
                Re: "Hackers" vs. "Crackers" The Natural Philosopher <tnp@invalid.invalid> - 2013-11-30 16:51 +0000
                Re: "Hackers" vs. "Crackers" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-01 17:13 +0100
            Re: "Hackers" vs. "Crackers" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-30 15:30 +0100
              Re: "Hackers" vs. "Crackers" The Natural Philosopher <tnp@invalid.invalid> - 2013-11-30 16:33 +0000
                Re: "Hackers" vs. "Crackers" Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-11-30 17:13 +0000

csiph-web