想请问一下印证的有关问题
程序员文章站
2022-05-07 10:25:57
...
想请教一下印证的问题
[code=PHP][/code]
include("conn.php");
$username = trim($_POST['username']);
$paw = md5(trim($_POST['paw']));
if($_POST[check]){
if($_POST[check]==$_SESSION[check_pic]){
echo "正确";
}else {
echo "错误";
}
}
$errmsg = '';
if (!empty($username)) {
if (empty($username)) {
$errmsg = '数据输入不完整';
}
if(empty($errmsg)) {
if (mysqli_connect_errno()) {
$errmsg = "数据库连接失败!\n";
}
else {
$sql = "SELECT * FROM user WHERE username='$username' AND pwd='$paw'";
$result = mysql_query($sql);
if ($result && mysql_num_rows($result) > 0) {
echo "";
session_start();
$_SESSION['login'] = 'true';
$_SESSION['user']=$username;
}else {
echo "";
}
mysql_free_result($result);
mysql_close($db);
}
}
}
?>
------解决方案--------------------
if($_POST[check]==$_SESSION[check_pic]) 你分别输出一下这两个值,然后转换一下大小写,统一就行!看看进这个判断里面吗
[code=PHP][/code]
include("conn.php");
$username = trim($_POST['username']);
$paw = md5(trim($_POST['paw']));
if($_POST[check]){
if($_POST[check]==$_SESSION[check_pic]){
echo "正确";
}else {
echo "错误";
}
}
$errmsg = '';
if (!empty($username)) {
if (empty($username)) {
$errmsg = '数据输入不完整';
}
if(empty($errmsg)) {
if (mysqli_connect_errno()) {
$errmsg = "数据库连接失败!\n";
}
else {
$sql = "SELECT * FROM user WHERE username='$username' AND pwd='$paw'";
$result = mysql_query($sql);
if ($result && mysql_num_rows($result) > 0) {
echo "";
session_start();
$_SESSION['login'] = 'true';
$_SESSION['user']=$username;
}else {
echo "";
}
mysql_free_result($result);
mysql_close($db);
}
}
}
?>
------解决方案--------------------
if($_POST[check]==$_SESSION[check_pic]) 你分别输出一下这两个值,然后转换一下大小写,统一就行!看看进这个判断里面吗
相关文章
相关视频
上一篇: 配置mysql odbc出现错误的解决
下一篇: 关于虎头的4篇文章推荐