View Full Version : Login Password

01-17-2011, 04:48 AM


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<!-- Based on FTP log in by: Reinout Verkerk -->
<!-- Original: Gordon Hudson (sales@hostroute.com) -->
<!-- Web Site: http://www.hostroute.com/ -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function Login(form) {
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server) {
var htsite = "http://" + username + ":" + password + "@" + server;
window.location = htsite;
else {
alert("Please enter your username and password.");
// End -->


<form name=login>
<input type="hidden" name="server" value="www.yahoo.com/">
<input type=text name=username size=20>
<input type=password name=password size=20>
<input type=button value="Login!" onClick="Login(this.form)" name="button">

<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>

<!-- Script Size: 1.58 KB -->



AuthName "Restricted Area"
AuthType Basic
AuthUserFile /temp/.htpasswd
AuthGroupFile /dev/null
require valid-user

Evertime I enter the correct UserName and Password I get this Error:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; Media Center PC 6.0)
Timestamp: Sun, 16 Jan 2011 01:42:45 UTC

Message: A security problem occurred.

Line: 21
Char: 1
Code: 0
URI: file:///C:/test/htmllogin/login.htm

01-17-2011, 09:20 PM
Are you sure your paths are correct? You seem to be using a windows server, but your AuthUserFile and AuthGroupFile paths are using *nix-style paths.

01-19-2011, 12:27 PM
I am using Windows...can you tell me the correct syntax?
I just noticed I dont have a AuthGroup directory..could that be the problem?

01-19-2011, 09:06 PM
The authuser is the bigger problem. That authgroup can be removed since its pulling from /dev/null. On Windows, there is no such thing as /temp/.password, the closest *may* be C:\Temp\.password if thats what you named it when you generated it from apache. Shouldn't be in temp though.

01-20-2011, 03:12 PM
I forgot to mention I have tried c:\temp\.password and still getting the same error. I was tring this all out as a test before I intergrated this into my website.

01-20-2011, 03:58 PM
Where did you save the password file to when you ran the htpasswd (http://httpd.apache.org/docs/current/programs/htpasswd.html) program? That will be where you want to point the authuserfile to.

01-22-2011, 05:53 PM
Yeah looks like a path issue or I usually called it a landing page. Have you tried placing your correct credentials as default parameters?
That is usually my main step in troubleshooting issues like this. And also check the format of the username and password field.
Make sure to make it as a string field so it will recognize the characters your typed in correctly. Let me know if that resolves your issue.