Page 1 of 1
Urlencoding Question
Posted: Wed Aug 29, 2007 9:46 am
by phibertek
Hello,
I am trying to pass a link from siteA to siteB in the format below:
http://www.siteB.com/my.php?e%3D%16%84% ... 5%B7%5D%A3
This string is a blowfish encrypted string that I am trying to send over from siteA to siteB. I've encoded the URL because of all the special characters. On siteB I am trying to do a echo $_REQUEST['e'], but there is no value for 'e' when the URL is passed. Do I have to decode it first? And if so, can someone help me understand the process?
Regards,
-Ptek
Posted: Wed Aug 29, 2007 9:49 am
by VladSun
Sample Site
Posted: Wed Aug 29, 2007 10:03 am
by phibertek
VladSun,
The url I supplied is an example. I'm trying not to publish the customer's site because I am working on a security detail. I need help with the concept of urldecoding urlencoded data passed in a url.
-Ptek
Posted: Wed Aug 29, 2007 10:09 am
by VladSun
I've just pointed that it is not a proper URL - you missed the "=" sign after "e"...
I've always used base64encode for this issue.
Posted: Wed Aug 29, 2007 10:10 am
by CoderGoblin
The full url should not be encoded. Only the "values" of the GET variables. Encoding the full url also encodes the "=" which is required to identify the variable names.
AYI YI!
Posted: Wed Aug 29, 2007 10:13 am
by phibertek
VladSun,
Thank you dearly!
Ptek
Actually!
Posted: Wed Aug 29, 2007 10:16 am
by phibertek
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is my test. am I encoding the wrong thing?
Code: Select all
$encr = new pcrypt(MODE_ECB, "BLOWFISH", "secretkey");
$test = $encr->encrypt("This is Ptek");
$link = "e=$test";
$val = urlencode($link);
echo "$val<br>";
echo "<a href=http://www.siteB.com/my.php?$val>Click Me</a>";
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Nevermind, I seee
Posted: Wed Aug 29, 2007 10:17 am
by phibertek
Thanx! Yes, it works! Thank you for pointing that out!
-Ptek
Posted: Wed Aug 29, 2007 10:19 am
by VladSun
Yes, it's wrong
Code: Select all
$encr = new pcrypt(MODE_ECB, "BLOWFISH", "secretkey");
$test = $encr->encrypt("This is Mark");
$val = "e=" . urlencode($test);
echo "$val<br>";
echo "<a href=http://www.siteB.com/my.php?$val>Click Me</a>";