header( 'Content-Type:text/html;charset=utf-8 ');
session_start();
include_once("conn/conn.php");
$name=$_POST["username"];
$pass=$_POST["password"];
$sql="SELECT * from user where username='$name' and password='$pass'";
$r=mysqli_query($link,$sql);
$n=mysqli_num_rows($r);
if($r>0){
header('location:welcome.html');
}else{
echo "<script>alert('账号或密码错误');location.href='index1.php';</script>";
}
本文介绍了一个简单的PHP登录验证脚本实现。该脚本通过接收表单提交的用户名和密码,查询数据库并验证用户身份。若登录成功则跳转至欢迎页面,否则返回错误提示。
3953

被折叠的 条评论
为什么被折叠?



