?
Solved

Can SSI's see POSTed values

Posted on 2002-07-23
15
Medium Priority
?
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 3
15 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 7171908
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
ID: 7172158
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
ID: 7172717
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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
LVL 3

Author Comment

by:dplambert
ID: 7177412
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
ID: 7178408
where (physically) do you see the CGI #exec, and where the POST?
0
 
LVL 3

Author Comment

by:dplambert
ID: 7178424
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
ID: 7178482
again, **where** do you see #exec: on server or in browser?
If your CGI sees the POSTed data, where is the problem then?
0
 
LVL 3

Author Comment

by:dplambert
ID: 7179748
The server sees it, not the browser.
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7180056
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
ID: 7180059
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
ID: 7180153
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
ID: 7180183
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 200 total points
ID: 7180212
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
ID: 7180336
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
ID: 7180395
> 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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.
Suggested Courses

770 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