login.php
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="content-type">
</head>
<h1>管理员登录系统</h1>
<form action="loginProcess.php" method="post">
<table>
<tr>
<td>用户id</td>
<td><input type="text" name="id" /></td>
</tr>
<tr>
<td>密 码</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td><input type="submit" value="用户登录" /></td>
<td><input type="reset" value="重新填写" /></td>
</tr>
</table>
</form>
<?php
if(!empty($_GET['errno'])){
$errno=$_GET['errno'];
if($errno==1){
echo "<font color='red' size='3'>你的用户名或密码错误</font>";
}
}
?>
</html>
empManage.php(登录成功页面)
<?php
header ( "Content-type:text/html;charset=utf-8" );
echo "登录成功!...";
echo "<br/><a href='login.php'>返回重新登录</a>";
?>
<?php
//接受用户的数据
//1.id
$id = $_POST ['id'];
//2.密码
$password = $_POST ['password'];
//简单验证
if ($id == "100" && $password == "123") {
//合法
header ( "Location:empManage.php" );
//如果要跳转,最好加上exit
exit ();
} else {
//不合法
header ( "Location:login.php?errno=1" );
exit ();
}
?>