call back to my own script

B

burrell.john

Hi,
I have the following code
I want to call back to the same cgi code on the same server - but on
submit I merely get the relative path appended to the original URL.
How to fix?

TIA

J

#!/usr/bin/perl
use strict;
use warnings;
use CGI ':standard';
print header,
start_html('Enter Logon Details'),
h1('Enter Logon Details`'),
h1($MyId),
start_form,
"What's your name? ",textfield('name'),p,
"What's your password? ",textfield('password'),p,
submit,
end_form,
hr;
 
B

burrell.john

I notice that you are using CGI.pm's start_form() method.


That's what should happen when start_form() is called without
parameters, as in your case.


I'm not able to reproduce that behaviour. Can you give us more details?
Thanks for your help! Added an action param to start_form!Got further
now.
However the URL I have contructed does not contain the values captured
by the pop up.
http://192.168.1.21/cgi-bin/tool4.cgi?LinkId=36633&Password=param('password')&Username=param('name')
Anyone like to help?
TIA

J

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use CGI::pretty;

use Digest::MD5 qw(md5 md5_hex md5_base64);
my $LinkId = param( 'LinkId' );
print header,
start_html('Enter Logon Details'),
h1('Enter Logon Details`'),
h1($LinkId),
start_form (-action => "http://192.168.1.21/cgi-bin/tool4.cgi?
LinkId=${LinkId}&Password=param('password')&Username=param('name')"),
"What's your name? ",textfield('name'),p,
"What's your password? ",textfield('password'),p,
submit,
end_form,
hr;
my $digest = md5(param('password'));
 
T

Tad J McClellan

It is bad form to quote .sigs.

Thanks for your help! Added an action param to start_form!Got further
now.
However the URL I have contructed does not contain the values captured
by the pop up.
http://192.168.1.21/cgi-bin/tool4.cgi?LinkId=36633&Password=param('password')&Username=param('name')


Form values only go in the URL for HTTP GET requests.

Anyone like to help?


You can help yourself by reading the documentation for the function
that you are using.

start_form() defaults to making an HTTP POST request, where the form
values go to STDIN rather than to the env var that contains the URL.

You need to give start_form() a "-method=>'GET'" argument as well
as an "-action" argument.
 
P

philip.kingsten

It is bad form to quote .sigs.


Form values only go in the URL for HTTP GET requests.


You can help yourself by reading the documentation for the function
that you are using.

start_form() defaults to making an HTTP POST request, where the form
values go to STDIN rather than to the env var that contains the URL.

You need to give start_form() a "-method=>'GET'" argument as well
as an "-action" argument.

--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"- Hide quoted text -

- Show quoted text -
Thanks - have read the docs a couple of times - lack some
understanding I am afraid

print header,
start_html('Enter Logon Details'),
h1('Enter Logon Details`'),
h1($LinkId),
start_form (-action => "http://192.168.1.21//cgi-bin/tool3.cgi?
LinkId=$LinkId", -method=>'GET'),
"What's your name? ",textfield('name'),p,
"What's your password? ",textfield('password'),p,
submit,
end_form,
hr;
However the URL that gets built mysteriouly contains the name and
password that I entered + submit+Query no sogn of LinkId though
http://192.168.1.21://cgi-bin/tool3.cgi?name=fred&password=bert&.submit=Submit+Query

Strange?
 
J

Joost Diepenmaat

Thanks - have read the docs a couple of times - lack some
understanding I am afraid

print header,
start_html('Enter Logon Details'),
h1('Enter Logon Details`'),
h1($LinkId),
start_form (-action => "http://192.168.1.21//cgi-bin/tool3.cgi?
LinkId=$LinkId", -method=>'GET'),
"What's your name? ",textfield('name'),p,
"What's your password? ",textfield('password'),p,
submit,
end_form,
hr;
However the URL that gets built mysteriouly contains the name and
password that I entered + submit+Query no sogn of LinkId though
http://192.168.1.21://cgi-bin/tool3.cgi?name=fred&password=bert&.submit=Submit+Query

Strange?

I don't feel like looking it up, but I guess that submitting the form as a
GET request clobbers any arguments specified in the action.

You really shouldn't use GET on a login form anyway. See the relevant
parts of the CGI/HTTP specs.

So, use POST and/or put LinkId in a hidden field.

Joost.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top