21,881
社区成员
发帖
与我相关
我的任务
分享
<!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>
<table width="411" border="0" cellspacing="3" cellpadding="0">
<tr>
<td><div align="center">用户登陆</div></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="5-3action.php">
<label>
<div align="center">用户名:
<input type="text" name="textfield" id="textfield" />
</div>
</label>
</form>
</td>
</tr>
<tr>
<td><form id="form2" name="form2" method="post" action="5-3action.php">
<label>
<div align="center">口令:
<input type="password" name="textfield2" id="textfield2" />
</div>
</label>
</form>
</td>
</tr>
<tr>
<td><form id="form3" name="form3" method="post" action="5-3action.php">
<label>
<div align="center">
<input type="submit" name="button" id="button" value="提交" />
<input type="reset" name="button2" id="button2" value="重置" />
</div>
</label>
</form>
</td>
</tr>
</table>
</body>
</html>
<!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>COOKIE实现用户登陆</title>
</head>
<body>
<?php
$_COOKIE["user_name"]=$_POST["user_name"];
$_COOKIE["user_pw"]=$_POST["user_pw"];
if($_COOKIE["user_name"]=="php" && $_COOKIE["user_pw"]== "php5")
{
echo "恭喜您,用户名和口令正确,登陆成功!";
}
else
{
echo "您输入的用户名为:".$_COOKIE["user_name"];
echo "口令为:".$_COOKIE["user_pw"];
echo "但是不正确,请尝试:php和php5;"
}
?>
<br><a href = "5-3action-check.php">单击检测Cookie的值是否可以页间传递</a>
</body>
</html>
<!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>
<form name="form1" method="post" action="5-3action.php">
<table width="280" height="96" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td colspan="2" align="center" bgcolor="#ffffff">用户登陆</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">用户名:</td>
<td align="left" bgcolor="#ffffff">
<input type="text" name="user_name" size="12">
</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">口令:</td>
<td align="left" bgcolor="#ffffff">
<input type="password" name="user_pw" size="12">
</td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#ffffff">
<input type="submit" name="Submit" value="提交" size="12">
<input type="reset" name="Submit2" value="重置" size="12">
</td>
</tr>
</table>
</form>
</body>
</html>
<!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>
<form name="form1" method="post" action="5-3action.php">
<table width="280" height="96" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td colspan="2" align="center" bgcolor="#ffffff">用户登陆</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">用户名:</td>
<td align="left" bgcolor="#ffffff">
<input type="text" name="user_name" size="12">
</td>
</tr>
<tr>
<td align="right" bgcolor="#ffffff">口令:</td>
<td align="left" bgcolor="#ffffff">
<input type="password" name="user_pw" size="12">
</td>
</tr>
<tr>
<td colspan="2" align="right" bgcolor="#ffffff">
<input type="submit" name="Submit" value="提交" size="12">
<input type="reset" name="Submit2" value="重置" size="12">
</td>
</tr>
</table>
</form>
</body>
</html>
$_COOKIE["user_name"]=$_POST["user_name"];
$_COOKIE["user_pw"]=$_POST["user_pw"];