Hello everyone. I am currently working on the HTML / Javascript front end of a web forum system (perlBB). I have a couple of questions that would I would like to ask.
1. Is the way to include an external javascript file in a page like this?
<head>
<link href="md5.js" rel="text/javascript">
</head>
2. On my login page I need to get a username and password from the user with a form. I then need to read the password field with Javascript and pass the value to a function that will return the MD5 hash of it. Then the plaintext password gets replaced with the hash on the form and the form is submitted. Will this work?
<html>
<head>
<script language="javascript" type="text/javascript">
function process_form(form) {
var password = form.password.value;
var pwd_hash = hex_md5(password);
form.password.value = pwd_hash;
document.login.submit();
}
</script>
</head>
<body>
<form action="forum.cgi?login+1" method="post" onsubmit="process_form(this.form)" name="login">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
Save a 1 hour cookie please <input type="checkbox" name="cookie"><br>
<input type="submit" value="Login">
</form>
</body>
</html>
Note: I'm using an open source MD5 javascript implementation, whose function are not shown here.
I am of course already testing out this approach. If someone could point if I've gone wrong somewhere and how I should be doing this it would be really usefull. Any advice appriciated.
Steven.