Page 1 of 1

Urgent Help Needed Please ! - $_REQUEST Shenanigans

Posted: Thu Jun 15, 2006 9:09 am
by CHEESEMAKER67
Hi guys and gals,

I'm trying to use $_REQUEST to pull the value of an encrypted variable back off the URL. The URL looks like this :

http://www.foo.com/blah.php?encrypted=F ... xM5CAYPJwo

and I try to read it using :

$str1=$_REQUEST['encrypted'];

When I try to decrypt this it fails. However, if I put the raw string out of the URL using cut and paste into decrypt algorithm it works perfectly. I've done a comparison between what $_REQUEST gives m and what vut and paste gives me and the 2 strings are below :

Cut and paste
FDUqHR4xCjx4fg8RJDItNxM5CAYPJwo8YRx0QHh7dnd2cH5ZWHQPQQdgfyIaBRY9DiV2EltyB0MDaBtFZ2cEcXdse1lbcxpDA2hpWXlndXV+A3ldKXsBRU5+DQwLIzYtCS52Wlp1DkILa381Jzk3KzN8eVBFdxEyZQsaInhrAwkLYQYoPwF/VXI8PQYvJTEXIjI+BR9/ejJnGxExDnASKjQ1CAYPJ2UWQC01AHcbAxEECQ4tTQFhQWE9KgEmIn8IBhUIIS4GETRaPi01IzJ/dWFyDzoOIUIBVgstFT4jMXhhAgo/PX8=

$_REQUEST
FDUqHR4xCjx4fg8RJDItNxM5CAYPJwo8YRx0QHh7dnd2cH5ZWHQPQQdgfyIaBRY9DiV2EltyB0MDaBtFZ2cEcXdse1lbcxpDA2hpWXlndXV A3ldKXsBRU5 DQwLIzYtCS52Wlp1DkILa381Jzk3KzN8eVBFdxEyZQsaInhrAwkLYQYoPwF/VXI8PQYvJTEXIjI BR9/ejJnGxExDnASKjQ1CAYPJ2UWQC01AHcbAxEECQ4tTQFhQWE9KgEmIn8IBhUIIS4GETRaPi01IzJ/dWFyDzoOIUIBVgstFT4jMXhhAgo/PX8=

As you will see, the + signs in the cut and pasted one have ben converted into CR or LF in the $_REQUEST one. Has anybody any idea how I can get round this please ?

Any help much appeciated

Cheers

Cheesemaker.

Posted: Thu Jun 15, 2006 9:25 am
by bdlang
Take a look at urlencode() and htmlentities() for solutions.

thanks but..

Posted: Thu Jun 15, 2006 9:32 am
by CHEESEMAKER67
Thanks for the prompt reply, but I've tried both of those already without success. I've even tried using $_GET instead of $_REQUEST which gave the same result. Surely there must be some way of getting he actual string from a URL...

:(

Posted: Thu Jun 15, 2006 9:35 am
by TheMoose
Maybe just replace any space character with the + sign after the request?

Code: Select all

$str1 = str_replace(" ", "+", $_REQUEST['encrypted']);

Thanks

Posted: Thu Jun 15, 2006 9:44 am
by CHEESEMAKER67
Wow, what a terrible cludge ! A programmer after my own heart :)

Even better is that it works !

Thanks very much to both of you who replied to my post. Much appreciated. A virtual pint on me guys !

Cheers

CheeseMaker