Page 1 of 1

Help needed urgently login and IE8

Posted: Thu Nov 07, 2013 4:57 am
by hybris
Hi i used the guide http://www.wikihow.com/Create-a-Secure- ... -and-MySQL

to create a loginscript for my homepage. It is working fine in all browsers except Internet Explorer.

My login.html looks like this:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="sha512.js"></script>
<script type="text/javascript" src="forms.js"></script>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="../aaa.css">
<style type="text/css">
</style>
</head>

<?php
if(isset($_GET['error'])) { 
   echo 'Error Logging In!';
}
?>
<form action="process_login.php" method="post" name="login_form">
<input type="text" name="email" />
<input type="password" name="p" id="password"/>
<input type="button" value="Login" onclick="formhash(this.form, this.form.password);" />                
</form>
and the code works as i said flawless on the other browsers. In IE8 however I get a msg in the statusbar saying the page contains error and the only thing that happens when i press the login button is that everytime i hit the button the page creates a new inputfield so if I clock the button 100 times i end up with my 2 original input fields the submitbutton and then 100 empty input fields.

I can't figure out why IE8 behaves like this :( please help.

ps. I strongly suspect its the // onclick="formhash(this.form, this.form.password) // part that causes the problem but I dunno how to rewrite it so it also works with IE.

Re: Help needed urgently login and IE8

Posted: Thu Nov 07, 2013 5:41 am
by Celauran
You've not shown us any code, so I'm not sure how we're supposed to help.

Re: Help needed urgently login and IE8

Posted: Thu Nov 07, 2013 8:17 am
by hybris
Yeah sorry, I thought it was the function onclick that didnt work but now I pinpointed the problem to the forms.js

It had the code

Code: Select all

 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);
   // Make sure the plaintext password doesn't get sent.
   password.value = "";
   // Finally submit the form.
   form.submit();
   }
}
And IE didnt like the p.type = "hidden"; line so I made an if statement to separate IE from other browsers and by removing the line p.type... for the IE versions I get the script to work in IE.

However that also creates an inputbox with the hashed pw value that is visible for some seconds before redir and I do not want that. Im trying to find the syntax to work with IE but no luck...

I tried

p.visibility = "hidden";
p.style.visibility = "hidden";
p.type.visibility = "hidden";

any other suggestions?

Thanks

Re: Help needed urgently login and IE8

Posted: Thu Nov 07, 2013 9:37 am
by hybris
Ok solved it myself:

p.style.visibility = "hidden";

was the magic word for IE.

Unfortunately my browser saved the old file in tempfiles so the changes didnt take effect haha.. could have saved me a couple of hours work if i had figured that out sooner :/