日期:2014-05-16 浏览次数:20974 次
用asp,Perl忘完了。
先写一个登陆表单。假设reg.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>西路登陆页面</title>
</head>
<body>
<FORM action="pass.asp" method="post">
<table cellpadding=2 cellspacing=0 border=0>
<tr>
<td><font face="arial,helvetica" size="2"><b>Username</b></font></td>
<td><input type="text" name="username" size="20"></td>
</tr>
<tr>
<td><font face="arial,helvetica" size="2"><b>Password</b></font></td>
<td><input type="password" name="password" size="20"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Log In"></td>
</tr>
</table>
</FORM>
<p><a href="1.asp">进入</a></p>
<p><span lang="en-us"><a href="signout.asp">loginout</a></span></p>
</body>
</html>
再来一个登陆验证 pass.asp
<%
Option Explicit
Dim username, password
username = Request.FORM("username")
password = Request.FORM("password")
'Change the username and password values below change the login
if (username = "admin") and (password = "admin") then
Response.Cookies("loginadmin") = "True"
Response.Redirect("登陆成功.asp")
end if
Response.Redirect("login.asp")
%>
成功则进入登陆成功.asp页面
失败则返回login.asp
以下注销页面: loginout.asp
<%
Response.Cookies("loginadmin") = ""
Response.Redirect("login.asp")
%>
你也可以用数据库存储,当然是多用户时候了。简单的话这样就行了。