query_string test and strip.

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default query_string test and strip.

    Could someone give me the topics to look up on php.net, to be able to work
    out how to remove stuff added to a query_string?

    I wish to check $QUERY_STRING, and remove any user added extras.

    TIA

    PhilM


    PhilM Guest

  2. Similar Questions and Discussions

    1. CGI.Query_String Login/Logout Problem
      Here is my form for logging in; <form name="login_form" method="post" action="#CGI.SCRIPT_NAME#?#CGI.QUERY_STRING#"> I use the CGI.SCRIPT_NAME and...
    2. Parse cgi.query_string
      I have a payment gateway that returns all its results in a humongous cgi.query_string. I would like to parse through it and assign variables and...
    3. $QUERY_STRING not vaialable
      Hi NG! I have the var $QUERY_STRING nit available. PHP 4.3.8 is running on Windows Server 2003 and IIS6, installed as CGI, not as ISAPI. The...
    4. Test::Unit -- multiple errors in test method ???
      Hi ! I have been writing some unit tests with Test::Unit. I've noted that when an assertion fails in a test method, the remaining assertions...
    5. Method test::unit::TestSuite#<<(test)
      Hi, I suggest to change the definition of this method slightly: current: # Adds the test to the suite. def <<(test) @tests << test end
  3. #2

    Default Re: query_string test and strip.

    PhilM wrote:
    > Could someone give me the topics to look up on php.net, to be able to work
    > out how to remove stuff added to a query_string?
    >
    > I wish to check $QUERY_STRING, and remove any user added extras.
    use explode() where & is the divider, then remove the index from the array
    that you don't want to keep and the implode the rest of the array back.


    //Aho
    J.O. Aho Guest

  4. #3

    Default Re: query_string test and strip.


    "J.O. Aho" <user@example.net> wrote in message
    news:2tq9ctF22i48gU1@uni-berlin.de...
    > PhilM wrote:
    > > Could someone give me the topics to look up on php.net, to be able to
    work
    > > out how to remove stuff added to a query_string?
    > >
    > > I wish to check $QUERY_STRING, and remove any user added extras.
    >
    > use explode() where & is the divider, then remove the index from the array
    > that you don't want to keep and the implode the rest of the array back.
    >
    >
    > //Aho
    so, if my url including $QUERY_STRING looks like

    /www.webhost/index.php?gallery&

    $test=explode('&',$QUERY_STRING);
    $QS=$test[0];

    and then use $QS to determine, thru a switch statement, which content to
    serve, would that be enough to prevent malicious/accidental fiddling?

    Or would I be better comparing $QUERY_STRING for known permissible values,
    and then setting and using $QS with the value detected?

    (it's late 4:10 am... sorry if this is a daft Q)


    PhilM Guest

  5. #4

    Default Re: query_string test and strip.

    PhilM wrote:
    > "J.O. Aho" <user@example.net> wrote in message
    > news:2tq9ctF22i48gU1@uni-berlin.de...
    >
    >>PhilM wrote:
    >>
    >>>Could someone give me the topics to look up on php.net, to be able to
    >
    > work
    >
    >>>out how to remove stuff added to a query_string?
    >>>
    >>>I wish to check $QUERY_STRING, and remove any user added extras.
    >>
    >>use explode() where & is the divider, then remove the index from the array
    >>that you don't want to keep and the implode the rest of the array back.
    >>
    >>
    >> //Aho
    >
    >
    > so, if my url including $QUERY_STRING looks like
    >
    > /www.webhost/index.php?gallery&
    >
    > $test=explode('&',$QUERY_STRING);
    > $QS=$test[0];
    >
    > and then use $QS to determine, thru a switch statement, which content to
    > serve, would that be enough to prevent malicious/accidental fiddling?
    >
    > Or would I be better comparing $QUERY_STRING for known permissible values,
    > and then setting and using $QS with the value detected?
    >
    > (it's late 4:10 am... sorry if this is a daft Q)
    >
    >
    I guess picking out those statements that are allowed should be easiest, pick
    them out from your $test and push them into $QS.


    //Aho
    J.O. Aho Guest

  6. #5

    Default Re: query_string test and strip.

    Cheers for that

    Regards, PhilM


    PhilM Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139