It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

.htaccess and Javascript -- almost working!

.htaccess and Javascript -- almost working!

Postby andkhl on Wed Mar 28, 2007 8:45 pm

The javascript code that I use can access .htaccess to see if the username / password pair matches the one in the html form after the Sumbit button has been clicked.

Firefox works great (with the exception of the confirmation box that pops up on the screen asking you if you are sure you want to use the user name that you've JUST used in order to log in). Netscape 7 works too, but the PROBLEM is that after one has logged in, his/her user name and password are displayed in the Address Field in the browser, like this: http://[COLOR="Red"]user_name: password[/COLOR]@www.site.com/secureDirectory/ (Example: http://johnDoe:myPassword@www.hello.com/myProtectedDir/)

Internet Explorer 6.0 does NOT work at all, and I can't seem to figure out why the javascript code is not working in this browser. In fact, if you click on the above non-working link, you will get the error page that looks exactly like what I am getting here in IE 6.0...

Questions:

1) How do I need to modify the script so that USER_NAME and PASSWORD are not displayed in the Address Bar of Netscape (and IE)?
2) What error in the code prevents it from working in IE 6.0?

Thank you. I appreciate your help....


Code: Select all
<!-- Begin
function getIn(loginForm) {
var username = document.loginForm.userName.value;
var password = document.loginForm.pass.value;
var server = document.loginForm.server.value;
if (username && password && server) {
var htsite = "http://" + username + ":" + password + "@" + server;
window.location = htsite;
}
else {
alert("Please enter your username and password.");
   }
}
//  End -->



=========================================================

<body>

<table style="margin:0px;"border="1" width="100%" id="table1" cellspacing="1">
<tr>
<td>
<form method="POST" action=" " name="loginForm">
<input type="hidden" name="server" value="www.mailbox-it.com/tempNewSite/info_university/">
<table style="margin:0px"width="100%">
<tr>
<td>User Name</td>
<td><input type="text" name="userName" size="20"></td></tr>
<tr>
<td>Password</td>
<td><input type="password" name="pass" size="20"></td></tr>
<tr>
<td>&nbsp;</td>
<td><input type="button" value="Log In" name="button" onclick="getIn()"></td></tr>
</table>
</form>
</td>
</tr>
</table>

</body>
andkhl
 
Posts: 2
Joined: Wed Mar 28, 2007 8:26 pm

Postby andkhl on Wed Mar 28, 2007 10:40 pm

Moderators: please move my topic to the JavaScript section... Sorry, I posted this in the wrong place. Thank you.
andkhl
 
Posts: 2
Joined: Wed Mar 28, 2007 8:26 pm


Who is online

Users browsing this forum: No registered users and 0 guests