newuser
03-03-2005, 09:43 PM
Hi
I have a personal web site that I would like to restrict access to, and want to save the username and password in a text file (password.txt) what is the best way to read username and password from the file, my code doesn't seem to work, can anyone let me know whats wrong with this:
<SCRIPT LANGUAGE='JavaScript'>
var name='username';
var password='userpassword';
function ReadIt() {
var filename = 'password.txt';
if {
var fso, a, ForReading;
ForReading = 1;
fso = new ActiveXObject('Scripting.FileSystemObject');
file = fso.OpenTextFile(filename, ForReading, false);
var name = file.readline();
var password = file.readline();
file.Close();
location="http://www.theknot.com"
}
else {
alert("Invalid Password")
}
} else { alert("Invalid Name")
}
}
Thanks in advance
I have a personal web site that I would like to restrict access to, and want to save the username and password in a text file (password.txt) what is the best way to read username and password from the file, my code doesn't seem to work, can anyone let me know whats wrong with this:
<SCRIPT LANGUAGE='JavaScript'>
var name='username';
var password='userpassword';
function ReadIt() {
var filename = 'password.txt';
if {
var fso, a, ForReading;
ForReading = 1;
fso = new ActiveXObject('Scripting.FileSystemObject');
file = fso.OpenTextFile(filename, ForReading, false);
var name = file.readline();
var password = file.readline();
file.Close();
location="http://www.theknot.com"
}
else {
alert("Invalid Password")
}
} else { alert("Invalid Name")
}
}
Thanks in advance