<html>
<head>
<title>留言板</title>
</head>
<body>
<?php
include 'db.php';
session_start();
$username = $_POST["username"];
$password = $_POST["password"];
$select = "'select password from user where username='$username'";
$query = mysqli_query($link,$select);
if ($_POST["dl"]){
if ($username !="" && $password !=""){
if (mysqli_num_rows($query)>=1){?>
<meta http-equiv="refresh" content="1; url=./welcome.php" />
<?php } else {
echo "<script>alert('用户名或密码错误')</script>";
}
} else {
echo "<script>alert('请输入用户名和密码')</script>";
}
} else if ($_POST["zc"]){?>
<meta http-equiv="refresh" content="1; url=./registered.php" />
<?php }
?>
<table border="0" align="center" width="400">
<caption><h2>登录</h2></caption>
<form method="post" action="">
<tr><td>用户名:<input type="text" size="25" name="username" value="<?php echo @$_POST["username"]?>"></td></tr>
<tr><td>密 码:<input type="password" siaze="25" name="password" value="<?php echo @$_POST["password"]?>"></td></tr>
<tr><td><input type="submit" name="dl" value="登录"><input type="submit" name="zc" value="注册"></td></tr>
</form>
</table>
</body>
</html>
<head>
<title>留言板</title>
</head>
<body>
<?php
include 'db.php';
session_start();
$username = $_POST["username"];
$password = $_POST["password"];
$select = "'select password from user where username='$username'";
$query = mysqli_query($link,$select);
if ($_POST["dl"]){
if ($username !="" && $password !=""){
if (mysqli_num_rows($query)>=1){?>
<meta http-equiv="refresh" content="1; url=./welcome.php" />
<?php } else {
echo "<script>alert('用户名或密码错误')</script>";
}
} else {
echo "<script>alert('请输入用户名和密码')</script>";
}
} else if ($_POST["zc"]){?>
<meta http-equiv="refresh" content="1; url=./registered.php" />
<?php }
?>
<table border="0" align="center" width="400">
<caption><h2>登录</h2></caption>
<form method="post" action="">
<tr><td>用户名:<input type="text" size="25" name="username" value="<?php echo @$_POST["username"]?>"></td></tr>
<tr><td>密 码:<input type="password" siaze="25" name="password" value="<?php echo @$_POST["password"]?>"></td></tr>
<tr><td><input type="submit" name="dl" value="登录"><input type="submit" name="zc" value="注册"></td></tr>
</form>
</table>
</body>
</html>