62,272
社区成员
发帖
与我相关
我的任务
分享
index.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<h1>注册页面</h1>
<%
if request("msg")<>"" then
response.Write("<p>"&request("msg")&"</p>")
end if
%>
<form id="form1" name="form1" method="post" action="?action=reg">
<p>用户名:
<input type="text" name="username" id="username" />
</p>
<p>密码:
<input type="password" name="pwd" id="pwd" />
</p>
<p>
<input type="submit" name="submit2" id="submit2" value="提交" />
<input type="reset" name="submit" id="submit" value="重置" />
</p>
</form>
<%
if request("action")="reg" then
dim ming, word
ming=request.form("username")
word=request.form("pwd")
session("name")=ming
session("password")=word
response.Redirect("login.asp?msg=yes")
end if
%>
<p><a href="login.asp">用户你好,请登陆!</a></p>
</body>
</html>
login.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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>
<%
if request("action")="login" then
if request.form("username")=session("name") and request.form("pwd")=session("password") then
response.redirect("new.asp")
else
response.redirect("index.asp?msg=密码或用户名错误")
end if
end if
%>
<%
if request("msg")="yes" then
response.Write("<p>注册后请登录</p>")
end if
%>
<form id="form1" name="form1" method="post" action="?action=login">
<p>用户名:
<input type="text" name="username" id="username" />
</p>
<p>密码:
<input type="password" name="pwd" id="pwd" />
</p>
<p>
<input type="submit" name="submit2" id="submit2" value="提交" />
<input type="reset" name="submit" id="submit" value="重置" />
</p>
</form>
</body>
</html>
new.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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>
用户密码正确,欢迎登陆!
</body>
</html>