使用自举,我已经打开了从导航栏登录目的的模态窗口。 如果登录凭据失败,模态消失一样它如果证书是成功的。 怎么样,通过PHP验证过程后运行,可我做了模态重新显示为用户再次尝试登录? 非工作相关的代码是:
PHP输入验证码:
<head>
<?php
if(PassHash::check_password($row["password"], $_POST['pwd1']))
$_SESSION["login"] = 1;
$_SESSION['btnhs'] = 3;
} else {
$_SESSION["login"] = 0;
$loginErr ="Username or password incorrect.";
?>
<script type="text/javascript">
$(function() {
$('#myModal').modal('show');
});
</script>
<?php
}
</head>
HTML:
<!-- Modal -->
<div class="modal fade" tabindex="-1" id="myModal" role="dialog" data-backdrop="static">
<div class="modal-dialog" data-backdrop="static">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header" style="padding:35px 50px;">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4><span class="glyphicon glyphicon-lock"></span> Login</h4>
</div>
<div class="modal-body" style="padding:40px 50px;">
<form method="post" autocomplete="on" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
<div class="form-group">
<label for="usrname"><span class="glyphicon glyphicon-user"></span> Username</label>
<input type="text" class="form-control" required="" name="uname" id="uname" autofocus="" placeholder="Enter username">
</div>
<div class="form-group">
<label for="psw"><span class="glyphicon glyphicon-eye-open"></span> Password</label>
<input type="password" class="form-control" required="" name="pwd1" id="pwd1" placeholder="Enter password">
<span class="error" style="color: red"><?php echo $loginErr;?></span><br>
</div>
<div class="form-actions">
<button type="submit" name="login" class="btn btn-success btn-block"><span class="glyphicon glyphicon-log-in"></span> Login</button>
</div>
</form>
</div>
我想打电话从登录不成功的密码JavaScript片段,但是这是行不通的。 任何人都可以看到什么是不对的,并提供了一个解决方案? 谢谢。