<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>asp Tutorial User login, exit login function </title>
<body>
<form action= "Login.asp" method= "post" name= "LoginForm" id= "LoginForm" onsubmit= "return check ();" >
<table width= "border=" 0 "cellspacing=" 5 "cellpadding=" 0 ">
<tr>
<td><strong> username:</strong> <input type= "text" size= "" name= "username" >
<strong> password:</strong> <input name= "userpass" type= "password" id= "Userpass" size= "></td>"
</tr>
<tr>
<td> remain logged in:
<input name= "Issave" type= "Radio" value= "0" >
Do not save
<input name= "Issave" type= "Radio" value= "1" checked>
Keep the day
<input type= "Radio" name= "Issave" value= ">"
Keep it for one months.
<input type= "Submit" name= "submit" value= "Login" ></td>
</tr>
</form>
</body>
Login.asp
<%
On Error Resume Next
Set Conn=server.createobject ("Adodb.connection")
Conn.Open ConnStr
If Err Then
Response.Write "&issqlver&" Database Tutorial connection error, please check the connection string. <br><br> "&err.source&" ("&err.number&")
Set conn = Nothing
Err.Clear
Response.End
End If
Dim Expires,userpass
Username=request ("username")
USERPASS=MD5 (Request ("Userpass"), 16)
Expires=request ("Issave")
If username<> "test" then
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open "SELECT * from Lg50_my_user where username= '" &username& "' and password= '" &userpass& "", Conn, 1,3
If rs.eof and Rs.bof then
Rs.close
Set rs=nothing
Response.Write ("<script language= page Special effects >alert (' Please enter the correct username and password '); this.location.href= ' login.htm ';</script> ")
Response.End
Else
Response.Cookies (Cookiesname) ("username") =username
if int (expires) >0 then Response.Cookies (cookiesname). expires = Date+expires
Response.Redirect ("index.asp")
End If
Else
Response.Cookies (Cookiesname) ("username") =username
Response.Redirect ("index.asp")
Response.End
End If
%>
Exit Login
<%
If Request ("out") = "BBS" then
response.cookies (cookiesname) ("username") = ""
Response.Redirect "/www.111cn.net/login.asp?menu=out&bbs=bbs"
Else
Response.Cookies (Cookiesname) ("username") = ""
Response.Redirect ("login.htm")
End If
%> /blockquote>