php 用户登录验证

时间:2023-03-08 17:46:33
php  用户登录验证
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head> <body>
<h1>登陆界面</h1>
<form action="huihuachuli.php" method="post">
<div>用户名:<input type="text" name="uid" /></div>
<div>密码:<input type="password" name="pwd" /></div>
<input type="submit" value="登陆" />
</form>
</body>
</html>
<?php
session_start();
include("DBDA.php");
$db=new DBDA(); $uid=$_POST["uid"];
$pwd=$_POST["pwd"]; $sql="select pwd from users where uid='{$uid}'"; $mima=$db->StrQuery($sql); if($pwd==$mima)
{
$_SESSION["uid"]=$uid;
header("location:zhuye.php");
}
else
{
echo "用户名或密码错误";
}