query_string test and strip.

This is a discussion on query_string test and strip. within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Could someone give me the topics to look up on php.net, to be able to work out how to ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-21-2004
PhilM
 
Posts: n/a
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


Reply With Quote
  #2 (permalink)  
Old 10-21-2004
J.O. Aho
 
Posts: n/a
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
Reply With Quote
  #3 (permalink)  
Old 10-21-2004
PhilM
 
Posts: n/a
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)


Reply With Quote
  #4 (permalink)  
Old 10-22-2004
J.O. Aho
 
Posts: n/a
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
Reply With Quote
  #5 (permalink)  
Old 10-22-2004
PhilM
 
Posts: n/a
Default Re: query_string test and strip.

Cheers for that

Regards, PhilM


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:12 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0