Web Hosting Talk







View Full Version : = signs in CGI links?


nagromme
11-03-2000, 04:48 PM
I am using "framed.cgi" from monster-submit.com to automatically add a custom top or bottom frame to all external links on a site I am building. To link to an external page I just call the script with "?url=" like this:

href="/cgi-bin/framed.cgi?url=http://www.someurl.com"

So far so good, the problem is that many of the URLs I am linking to already contain an = sign, like this:

href="/cgi-bin/framed.cgi?url=http://www.someurl.com?x=something"

Apparently you can't have an = paremeter nested within an = paremeter (if I'm making any sense). As a result, the script truncates the URL starting at the = sign: "http://www.someurl.com?x"

My question: is there a way I can make the framed.cgi script NOT see that second = sign? Can I put the entire URL in some kind of delimiters? Can I replace the = sign with some other code that will still work as a URL?

If, as I suspect, this is a lost cause, I'd gladly take recommendations for a Perl alternative to "framed.cgi"--one that can handle this. (I tried to get Smart Frame from hotscript.com but the file doesn't seem to exist any longer even if you go to Smart Frame's home.)

Thanks.

Félix C.Courtemanche
11-03-2000, 07:47 PM
use a function to urlencode the string you wish to pass, then decode it when reading it.

I am unsure of how you do that in perl, but in PHP it is :
$somevar = urlencore($somevar);
all the special characters in a url are then escaped and will work fine.

Lawrence
11-04-2000, 10:18 PM
Of the top of my head, you can usually replace any symbol with a % and its ASCII number.

For example, I think a space can be %20

So all you need to do is find the ASCII number for = and replace the = with %num

Run a search for ASCII codes somewhere and you should find the correct number.