Solved

Can SSI's see POSTed values

Posted on 2002-07-23
15
164 Views
Last Modified: 2013-11-18
If I POST a form to a HTML page that has the following server side include in it:

<!--#exec cgi="cgi_bin/include/process.pl"-->

Will process.pl be able to work with the POSTed form values?
0
Comment
Question by:dplambert
  • 6
  • 6
  • 3
15 Comments
 
LVL 12

Expert Comment

by:lexxwern
Comment Utility
no. but you can send the values to the SSI thru query strings like this,
<!--#exec cgi="cgi_bin/include/process.pl?$VALUE"-->

in process.pl this can be fetched thru the following variable

$ENV{'QUERY_STRING'};
0
 
LVL 3

Author Comment

by:dplambert
Comment Utility
What if the form uses the GET method? I know that SSI's can see certain environmental variables of the caller, so I would think that QUERY_STRING would be populated.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
stop ! rethink what is happening:

  1. server parses html file, substitutes SSI statements
  2. server delivers result to client
  3. client (user) pushes button

when 3. happens, there is no longer any SSI available, so only what lexxwern suggest can work
0
 
LVL 3

Author Comment

by:dplambert
Comment Utility
I'm terribly sorry, but I ran some tests and I can see POST and GET form values in a CGI #EXEC include. Perhaps this isn't the case on all servers, but the web hosting company that I'm working with company (threadnet.com) can do it.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
where (physically) do you see the CGI #exec, and where the POST?
0
 
LVL 3

Author Comment

by:dplambert
Comment Utility
I had a form POST to a HTML page that contained a CGI #EXEC include. The include Perl file could see the POSTed data.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
again, **where** do you see #exec: on server or in browser?
If your CGI sees the POSTed data, where is the problem then?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 3

Author Comment

by:dplambert
Comment Utility
The server sees it, not the browser.
0
 
LVL 12

Expert Comment

by:lexxwern
Comment Utility
im not able to follow this here. lets look at things again...


(1) a form is posted to a certain cgi script.
(2) the cgi script has an SSI include and some HTML.
(3) you asked if SSI could see the posted variables sent to the main script, we said no.
(4) but when you included the other script through "exec cgi" and not "include file" you say it could see the variables, which i think it shouldn't but it apperently does on your system.
(5) but then you say,
>> The server sees it, not the browser.
i interpret this as you tried to print this posted variable thru your included file, but it gave out a null.

which means that the included script cannot access the posted variables from the main script.

is this what is happening. please correctme if my interpretation is wrong.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
and what has any FORM to do with the cgi processed on the server **before** the page (containing the GET FORM) is delivered to the browser?

Could you please explain what's the problem with lexxwern's suggestion?
0
 
LVL 3

Author Comment

by:dplambert
Comment Utility
testform.html has a <FORM> element with an ACTION attribute of "testform.html" (itself). It also has the following code in it:

<!--#exec cgi="cgi_bin/include/process.pl"-->

This directive is executed server-side, so only process.pl's results get sent to the browser.

There is no Perl in testform.html - it only has HTML. The Perl code is in process.pl.

The Perl code can see the POSTed form values, which I find very interesting.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
dplambert, please reread my very first comment until you're *used to the data flow* with SSI and FORMs
IMHO you're not understanding what happens, at the moment.
To get more used to it, also use the browser's "View Source" (or whatever it is called there), and compare that to your page you see on the server.
0
 
LVL 12

Accepted Solution

by:
lexxwern earned 50 total points
Comment Utility
hmm. i agree it is very interesting the way things work. but i think your approach is not the best.

in your <form>'s action attribute if you can directly have "process.pl" and then fetch the values from there.

if you dont know how to fetch posted data then have a look at http://cgi-lib.berkeley.edu/ and you can use the cgi-lib.pl hat they give for download.

i personally find it very easy to use.
0
 
LVL 3

Author Comment

by:dplambert
Comment Utility
ahoffmann -

<!--#exec cgi="cgi_bin/include/process.pl"--> never makes it to the browser per view source. It's substituted with the results (prints) of process.pl.

I agree that it's not the best way to do things.

Bottomline, I don't have a problem now. I posed a question and got the answer myself while testing. I didn't explain the question well enough.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> I agree that it's not the best way to do things.
don't agree: SSI is a good, and a portable way to do things ;-)

IMHO lexxwern answerd your question.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now