Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSI EXEC & Query String

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
0
0
GB
Hello,

I am using an SSI #EXEC URL="" , and trying to pass it a query string, if i put ?VAR1=foo&VAR2=bar all I get is the value of VAR1.

why is the second variable not passed to the CGI script?

is there a limit with SSI and the query string, I have URL Encoded the full URL to ensure this wasn't the problem, but still no joy.

any ideas?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Code:
?VAR1=[COLOR=red]"[/color]foo[COLOR=red]"[/color]&VAR2=[COLOR=red]"[/color]bar bar bar pint[COLOR=red]"[/color]
try encapsulating the vars with quotes

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Hi

What is your operating system ? Note, that on Unix and alike the ampersand ( & ) has a special meaning in command line. Try to put all the QUERY_STRING between quotes.

Feherke.
 
mbrooks -> yes CGI but have also tried my own URL code neither works.

PaulTeg -> I've tried but that stops all get vars from working (well the one that was)... here is the example.
Code:
<!--#EXEC CGI="/cgi-bin/myscript.cgi?PG="Support%20Step%20%26%20Productions%20Limited"&amp;TEST="test"" -->

feherke -> Windows/ActiveState, I've URL encoded and XHTML escaped the string, so it shouldn't matter about ampersand should it?

Everyone-> How do I correctly surround the query string with quotes, when the EXEC command is already in quotes?




"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Hi

1DM said:
Windows/ActiveState, I've URL encoded and XHTML escaped the string, so it shouldn't matter about ampersand should it?
Then no problem with the ampersand. 1) On Windows cmd.exe has no idea of running a process in background; 2) You are not running an external command as I supposed.

The ampersand must be written as HTML character entity ( &amp; ) only when is in HTML. The content of the SSI command is not HTML, as is evaluated and replaced before the content becomes a standard HTML document. So write it simply as is ( & ).

I think Paul also supposed you try to execute an external command and that is why he suggested the quoting. But for CGI there should not be there.

I would say this must work :
Code:
<!--#exec cgi="/cgi-bin/myscript.cgi?PG=Support%20Step%20%26%20Productions%20Limited&TEST=test" -->
If not, tell us how you test the presence of GET parameters in myscript.cgi.

Feherke.
 
ok my bad, I was using some bespoke URL GET vars code, I've re-written using CGI and all is fine.

You have no idea how much work i've got ahead of me changing my entire site & application to work with CGI.

Oh well I made the rod for my own back, so i should't complain really :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
According to the apache docs, you can't pass parameters using #exec cgi at all. You need #include virtual:
Code:
<!--#include virtual="/cgi-bin/myscript.cgi?PG=Support%20Step%20%26%20Productions%20Limited&TEST=test" -->
 
but this is Windoze with ActiveState , and I can't use virtual or cmd , it errors because my host only allows execution of scripts via EXEC CGI with SSI

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Hi

1DM said:
but this is Windoze with ActiveState , and I can't use virtual or cmd
That is not related to Windows or Perl version. SSI is handled by Apache using the mod_include module. But if your host does not allow you, this information will not help anyway.

Nice memory, ishnid. [thumbsup2] I completely forgot that restriction.

Feherke.
 
but if it's a restriction, how come it works ?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
I have no idea why it works :) What code are you using to parse the variables? Just normal CGI param() calls?
 
yup sure am. and any chance you could comment on my thread in the PERL forum about the switch module, i always take your advice!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top