View Full Version : Perl and Iframes
Kathryn
December 15th, 2004, 13:12
I am adding to an existing site. It is a portal of sorts. Want I want to do is use an iframe to display other sites(on an intranet).Some of these sites require a login and password but, In order to get to the site that I am creating you have to login. I want to pass this information to the sites I am calling, in order to keep them from having to login again.
On the page I am using buttons and javascript to send fill the iframe, the program is written in cgi and perl. I have a subparse script that will get the login and password from the login in all the sites.
Any ideas. Hope this made sense.
Thanks
Kathryn
Kathryn
December 15th, 2004, 14:29
The problem is that it is not passing the login information to the sites in the iframe.
mjz
December 15th, 2004, 16:00
hmm... do you want to pass user entered usernames andpasswords to an iframe? or will you be supplying the pass logging them in automatically?
some actual examples would help, some code, or to see the site in question...
if you name the iframe you should be able to pass form data to it by adding target=nameofirame to the form tag...
Kathryn
December 15th, 2004, 16:59
require "subparseform.pl";
&Parse_Form; #parse the information
$login = $formdata{'login'}; #capture the login name entered
$password = $formdata{'password'}; #capture the password entered
$button = $formdata{'main'}; #capture the button clicked
$uppassword = uc($password); #uppercase password
$lastPage = $ENV{'HTTP_REFERER'}; #captures the last page visited
******************************************************
This is where I get the info from the original login page(for the parent form)
**********************************************************
print <<EOF;
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from old browsers
var newWindow;
function writeLayer(text)
{
document.frames['myFrame'].location.href = text;
document.addrForm.location.value = text;
document.page.is
}
function closedclass()
{
newWindow = window.open'/scripts/classcount/classcount.cgi','', 'location=yes,toolbar=yes,status,scrollbars,HEIGHT=500,WIDTH =500,resizable=yes');
newWindow.document.close();
}
function onLoad(text)
{
if (text != "Microsoft Internet Explorer")
{
alert("netscape not supported");
history.back();
}
return true;
}
// --> End hide
</SCRIPT>
EOF
####################################################
This is the formmethod and iframe description of the HTML
*****************************************************
print "<FORM METHOD=\"POST\" NAME=\"form1\">\n";
print "<CENTER>";
print "<H3>\n";
print "FacTools Main Menu\n";
print "<BR><BR>\n";
print "<HR COLOR = \"goldenrod\" WIDTH = \"75%\">\n";
print "</CENTER>";
print "<iframe src=\"\" BODYBGCOLOR=\"#004000\" width=\"75%\" FRAMEBORDER=\"yes\" BGCOLOR=\"#004000\" BORDERCOLOR=\"GOLDENROD\" SCROLLING=\"auto\" height=\"80%\" align=\"right\" id=\"myFrame\"></iframe>\n";
*********************************************************
This is the button the user will click that will send them to the other page that needs the login information
*********************************************************
print <<TTT;
<INPUT TYPE="button" NAME="dropadd" onClick="writeLayer'/scripts/da/Test.cgi')" VALUE="AAOR Program;"><BR><BR>
********************************************************
This is a very long program hope I got the pertinant information.
Thanks
Kathryn
mjz
December 15th, 2004, 17:59
might help if i saw the site, but here's an idea....
encrypt the login info, add them to hidden form elements, make the dropadd button a submit button, send the form to Test.cgi and target myFrame... then let test.cgi unencrypt and use the username and pass to log in...
that doesnt work if you dont have control of the pages opened in the iframe though...
Kathryn
December 23rd, 2004, 14:19
I have decided to use cookies to store the username and password. How would I pass the javascript variable to a perl variable?
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.