homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Changing a login javascript to remove the confirmation step
Urgent Help Required on this Code

10+ Year Member

Msg#: 304 posted 5:47 pm on Mar 10, 2003 (gmt 0)

I am in urgent need of help to solve a problem i have with a javascript. Basically i have download a javascript from the net. it basically takes data from a form and posts it in another html file which pops up. the reason it posts it to another html file is to avoid leaving any trails in the computers history.

for example i cannot use a script that will leave the following trail in the history login.cgi?username=test&password=pass123 so the only way round is to post the data with hidden fields. The script i have does exactly that. However, the only problem is that when it pops up, using java the html file keeps the username and password as hidden fields, but requires that i click on a button to login. I wish to get rid of that and i want it to just automatically login (maybe using onload="document.Login.submit();" )

I would be very greatful if someone can help me on this.

Below is my code:

in the inital login page i have the following script between the <head> tags:

<script language="javascript" type="text/javascript">
function newWin(){
confirmWin = window.open('page02.html','confWin','width=640,height=480,scrollbars=yes,left=380,top=0')
confirmWin.opener = self;

and after the <body> tag i have the following:

<form name="loginfrm" method="post" onSubmit="newWin()">
Account ID
<br />
<input type="text" name="accountnumber" size="26" />
<br />
<br />
<input type="password" name="password" size="26" />
<br />
<input type="button" onclick="newWin()" value="Confirm Details" />

and on page02.html i have the following code between the <head> tag

<SCRIPT language="javascript" type="text/javascript">

var ttestFrm = opener.document.loginfrm;
var accid = opener.document.loginfrm.accountnumber;
var pwd = opener.document.loginfrm.password ;

function setData(){
document.write("<form method=POST action=login.cgi name=login>");
document.write("<input type=hidden name=username size=15 value=" + accid.value + ">");
document.write("<input type=hidden name=password size=15 value=" + pwd.value + ">");
document.write("<input type=submit name=submit value='Click Here to Login'>");


and i have the following code after the <body> tag:

<SCRIPT language="javascript" type="text/javascript">

Many thanks for your help

[edited by: jatar_k at 5:51 pm (utc) on Mar. 10, 2003]
[edit reason] no urls please [/edit]



10+ Year Member

Msg#: 304 posted 1:37 pm on Mar 11, 2003 (gmt 0)

I don't really understand why you are doing this, if it where a security issue there would be pop up windows all over the net.

Why not just POST the data from your inital login page form? I think that it would only leave a trail,
if the form's Action was GET rather than POST.

Anyhow's to help with with your script, add this line
document.login.submit(); eg

<SCRIPT language="javascript" type="text/javascript">

to page02.html

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved