Solved

Can SSI's see POSTed values

Posted on 2002-07-23
15
166 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
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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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 50 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS (line height?) issue 2 65
Is it true to say that Python is successor of Perl? 7 178
quoting a comma separated list 20 85
Cordova Camera plugin fails 2 120
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

822 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