一般的验证方式

//查询某个管理员是否存在
$sql="select*from user1 where name='ls'and password='xxxxxx'";
//看看有没有查询用户
if(查询到){
 header("admin.php");

}else{
 header("login.php");
}

防止sql注入
解决方案
使用预编译
改变验证数据库用户逻辑

$sql="select password from user1 where name='ls'";
看看有没有查询到记录
如果有说明用户存在
if(从数据库查询的密码=用户输入的密码){
 //合法
 head("admin.php");
}else{
 header("ok.php")
}

相关文章:

  • 2021-11-04
  • 2021-12-10
  • 2022-01-05
  • 2022-01-05
  • 2021-08-03
  • 2022-01-05
  • 2021-12-26
  • 2022-01-05
猜你喜欢
  • 2022-01-05
  • 2022-01-05
  • 2022-01-05
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-10-08
  • 2019-08-12
相关资源
相似解决方案