为什么在验证验证码的时候程序不能正确验证,请各位高手相助

cph1737 cph1737 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<?php
session_start();
include("conn.php");
$user=$_POST['user'];
$pwd=$_POST['pass'];
$yzm=$_POST['yzm'];
if($_POST['btnLogin']){
$sql="select * from `access` where `name`='$user' and `pwd`='$pwd'";
$rs=mysql_query($sql);
$result=mysql_fetch_array($rs);
if($result){
header("location:list.php");
$_SESSION[user]=$user;
}else{
echo "用户名或密码错误!";
}
}
?>
<html>
<head>
<title>添加留言</title>
</head>
<script language="javascript">
function check(){
if(document.login.user.value==""){
alert("用户名不能为空!");
login.user.focus();
return false;
}
if(document.login.pass.value==""){
alert("密码不能为空!");
login.pass.focus();
return false;
}
if(document.login.yzm.value==""){
alert("验证码不能为空!");
login.yzm.focus();
return false;
}
if(document.login.yzm.value!=document.login.hide.value){
alert("验证码错误!");
login.yzm.focus();
return false;
}

}

</script>

<body>
<?php
include("top.html");
?>
<center>
<table border="1">
<form name="login" method="post" action="login.php" onsubmit="return check()">
<tr>
<td>昵称:</td>
<td><input type="text" name="user"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="pass"></td>
</tr>
<tr>
<td>验证码:</td>
<td><input type="text" size="4" name="yzm" ><img src="imagecode.php"></td>
<input type="hidden" name="hide" value="<?php echo $_SESSION['check_pic']?>">

<?php echo $_SESSION['check_pic']?>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="btnLogin" value="登录">
<input type="reset" name="btnCancel" value="取消">   <a href="reg.php">注册</a>
</td>
</tr>
</form>
</table>
</center>
</body>
</html>
为什么在验证验证码的时候程序不能正确验证,请各位高手相助
...全文
评论 14
收藏 已收藏
分享
返回顶部
cph1737
基础编程 21,889 成员 140,329 内容