大佬教程收集整理的这篇文章主要介绍了我的登录页面不起作用,它只是刷新,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个登录和一个注册系统,注册工作正常,注册完成后存储了一个散列密码,但是当我登录时,没有任何反应,如果登录成功,我不会被重定向,如果不成功,我的错误消息不会出现,它只是刷新到同一个登录页面。
我有三个用于登录系统的页面。
具有 HTML 表单等的登录页面,以及设置后出现的会话(错误消息)
<form action="loginHandler.php" method="POST">
<h1>Log in </h1>
<input type="text" name="phone" placeholder="PHONE numbER" class="formtexts"><br>
<?php if(isset($_SESSION["h"])){ echo nl2br("$_SESSION[h]\r\n" ); unset($_SESSION["h"]); } ?>
<input type="password" name="password" placeholder="passworD" class="formtexts"> <br>
<?php if(isset($_SESSION["g"])){ echo nl2br("$_SESSION[g]\r\n" ); unset($_SESSION["g"]); } ?>
<a href="forgotpass.HTML" ID="forgotpassword"> Forgot password?</a> <br>
<button type="submit" name ="finishlog" ID="loginbutton">Log in</button> <br>
</form>
登录处理程序页面,主要处理页面并在一切顺利且验证成功时重定向到另一个页面。
if(isset($_POST['finishlog']))
{
if (!empty('phone') && !empty('password'))
{
$phone = $_POST['phone'];
$password = $_POST['password'];
$obj = new loginValIDation();
$obj->valIDateLogin($db,$phone,$password);
if(isset($_SESSION["h"])==false && isset($_SESSION["g"])==falsE)
{
header("LOCATIOn: first.php");
}
}
}
以及检查密码的验证页面
function valIDateLogin($db,$password)
{
$stmt = $db->prepare("SELECT password FROM reg WHERE phone = :phone ");
$stmt->bindParam(':phone',$phonE);
$stmt->execute();
$row = $stmt->fetchcolumn();
if($row > 0)
{
unset($_SESSION["h"]);
if( password_verify($password,$row)==falsE)
{
$_SESSION["g"]=" password is not correct,please check and try again";
header("LOCATIOn: loginPage.php");
}
else
unset($_SESSION["g"]);
}
else
{
$_SESSION["h"]=" phone number is not registered,please check and try again";
header("LOCATIOn: loginPage.php");
}
}
我不知道缺少什么,出了什么问题?
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的我的登录页面不起作用,它只是刷新全部内容,希望文章能够帮你解决我的登录页面不起作用,它只是刷新所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。