Jump to content

is there a way to protect get query parameters being overwriten?


Anti-Moronic

Recommended Posts

The $_SERVER['QUERY_STRING'] variable gives you the original query string, which you are free to parse up and handle yourself.  explode() using the '&' should work pretty well to get the name=value pairs.

Thanks, I just found a solution to it somewhere else. Quite a useful nifty little function:

 

$query  = explode('&', $_SERVER['QUERY_STRING']);
$params = array();

foreach( $query as $param )
{
  list($name, $value) = explode('=', $param);
  $params[urldecode($name)][] = urldecode($value);
}

 

I then parse those results and only use the first in the array (i.e. first occurrence of any given query string variable).

 

Thanks for the input!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.