PDA

View Full Version : dodgy password box


bee80
02-11-2009, 06:54 PM
has any1 ever had problems with a password box , when i click inside it , it jumps bk to the username box in a login form!! This only happens in chrome + firefox but not in IE7 n netscape??

davidj
02-11-2009, 09:33 PM
lets see the code

bee80
02-12-2009, 05:05 PM
heres the form code:


<form id="loginForm" name="loginForm" method="POST" action="<?php $_SERVER['PHP_SELF'];?>">
<label>Email<br />
<input name="email" type="text" id="email" size="16" maxlength="35" />
<br />
Password<br />
<input name="pwd" type="password" id="pwd" size="12" maxlength="15" />
<br />
<span class="style6">Remember me?</span>
<input name="remember" type="checkbox" id="remember" value="1" />
<br />
<input name="submitted" type="hidden" id="submitted" value="1" />
<input name="Submit" type="submit" onclick="MM_validateForm('email','','RisEmail','pwd','','R' );return document.MM_returnValue" value="Login" />
</label>
</form>
<?php echo $loginreject;?>


and php but i think its not due to this because it jumps back to username box b4 pressing submit, i have to hold left mouse bttn to enter password :


<?php require_once('Connections/lblconnect.php');// connect to database

session_start();

//catch fields and assign variables#

$email = $_POST['email'];
$pwd = $_POST['pwd'];
$encryp = sha1($pwd);
$submitted = $_POST['submitted'];
$remember = $_POST['remember'];
/////////////////////////////////

//if email and encrypted password match

if ($email && $encryp) {
////////////////////////////////////////////////////
$query = sprintf("SELECT * FROM users where email = '$email' and pwd == '$encryp'");
$result = @mysql_query($query);
$rowAccount = @mysql_fetch_array($result);
///////////////////////////////////////////////////
}

//if rowaccount has data

if($rowAccount) {

// set session ['id'] to users['id']

$_SESSION['id'] = $rowAccount['user_id'];

//send to home.php

header ("location:home.php");
exit;

// elseif has been submitted

}elseif($submitted){

//details do not match echo

$loginreject = "<h3>Your login failed <br /> Please try again</h3>";
}

?>

davidj
02-12-2009, 11:08 PM
try removing the JS validation on the form then retest it