这两种登陆验证方法哪里错了
第一种:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
$id=$_POST['id'];
$password=$_POST['password'];
$conn=mysql_connect("localhost","root","root");
if (!$conn){
die("连接失败:".mysql_errno());
}
mysql_select_db("emp",$conn) or die(mysql_errno());
mysql_query("set names utf8")or die(mysql_errno());
$sql = "select count(id) from admin where id='".$id."' and password='".md5($password)."'";
$res = mysql_query($sql,$conn);
$num = mysql_num_rows($res);
if($num){
header("location:empManage.php");
exit();
}else{
header("location:login.php?errno=1");
exit();
}
mysql_free_result($res);
mysql_close($conn);
?>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
$id=$_POST['id'];
$password=$_POST['password'];
$conn=mysql_connect("localhost","root","root");
if (!$conn){
die("连接失败:".mysql_errno());
}
mysql_select_db("emp",$conn) or die(mysql_errno());
mysql_query("set names utf8")or die(mysql_errno());
$sql="select password from admin where id=$id";
$res=mysql_query($sql,$conn);
if ($row=mysql_fetch_assoc($res)){
if ($row['password']==md5($password)){
header("location:empManage.php");
}
}
header("location:login.php?errno=1");
mysql_free_result($res);
mysql_close($conn);
?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号