Jump to content

Recommended Posts

I am trying to write a secure login for my site using php and javascript to not send a password in plain text.

I am trying to hide and hash the password prior to processing it and giving the user access to the system.

 

The problem I am havng is only with IE. When i type in the username and password it acts like it will process the page but it just creates a text box on the screen and if i continue to try and "submit" the form it just adds a new text box.

 

All other browsers i have tried (Firefox, Chrome, Opera and safari) work, IE just won't process the login correctly

 

what I have for the php is

 

<script type="text/javascript" src="mine.js"></script>
<script type="text/javascript" src="forms.js"></script>
<?php
if(isset($_GET['error'])) {
  echo 'Incorrect Username/Password';
}
?>
<form action="login.php" method="post" name="login_form">
  Username: <input type="text" name="username" /><br />
  Password: <input type="password" name="password" id="password"/><br />
  <input type="button" value="Login" onclick="formhash(this.form, this.form.password);" />
</form>

 

The javascript is

 

function formhash(form, password) {
var p = document.createElement("input");
form.appendChild(p);
  p.name = "p";
  p.type = "hidden"
  p.value = hex_mine(password.value);
password.value = "";
form.submit();
}

 

Any suggestions on what I can look at to try and get this to work with IE.

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/272896-ie-login-script-issue/
Share on other sites

Most likely the error happens because your input field is named "password" and you are using a variable called "password" in your function. IE tends to use elements name as objects in Javascript. Try to rename the variable in your functions to something else like "pass".

A tip about security, hashing the input using Javascript doesn't really make any difference since all the Javascript code is executed on the browser and can be reversed very easily. If you are really concerned about users security, just use an SSL certificate.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.