Hi People!
<script type="text/javascript" src="sha512.js"></script>
<script type="text/javascript" src="forms.js"></script>
<?php
if(isset($_GET['error'])) {
echo 'Error Logging In!';
}
?>
<form action="process_login.php" method="post" name="login_form">
Email: <input type="text" name="email" /><br />
Password: <input type="password" name="password" id="password"/><br />
<input type="button" value="Login" onclick="formhash(this.form, this.form.password);" />
</form>
Here is the contents of the forms.js file:
function formhash(form, password) {
document.write(password.value);
// Create a new element input, this will be out hashed password field.
var p = document.createElement("input");
// Add the new element to our form.
form.appendChild(p);
p.name = "p";
p.type = "hidden";
p.value = hex_sha512(password.value);
document.write("After hex call");
// Make sure the plaintext password doesn't get sent.
password.value = "";
// Finally submit the form.
form.submit();
}
The function formhash(form, password) gets called but the call to hex_sha512(password.value) doesn’t work.
Any help would be much appreciated!