利用ASP给主页加密 我们的目的是: *验证用户是否经过授权并根据结果设置相应的验证状态 *如果用户是经过授权的,验证状态置1 *如果用户是没有授权的,验证状态置0 下面显示的是verify.asp页的代码,你可以根据实际情况作一些相应的修改。 < % ’ Create a command object. This object serves to run our queries Set Cm = Server.CreateObject(“ADODB.Command”) ’ Specify the system DSN path Cm.ActiveConnection =“LoginDSN” ’ Now it’s time for the query. We need to check the user information ’ against the table tUsers Cm.CommandText=“SELECT * FROM tUsers WHERE ”& _ “UserName=’”& Request.Form(“UserName”) &“’ AND ”& _ “UserPassword=’” & Request.Form(“UserPassword”) & “’” ’ Set the query type. 1 means it is a SQL statement Cm.CommandType = 1 ’ Retrieve the results in a recordset object Set Rs = Cm.Execute ’ We now check if the user is valid. If user is valid, the recordset MUST ’ haverecord. Otherwise it is empty. If user exists, we set authentication ’ status to 1 and send the user to appropriate page, say welcome.asp. ’ Else send the user back to login.asp If Rs.EOF Then Session(“Authenticated”) = 0 Response.Redirect (“login.asp”) Else Session(“Authenticated”) = 1 Response.Redirect (“welcome.asp”) End If % > |
正在阅读:利用ASP给主页加密之二利用ASP给主页加密之二
2004-02-14 09:33
出处:PConline
责任编辑:zwg
键盘也能翻页,试试“← →”键