数据库 students 用到的表 User_info
User_info 表的字段:
user_Id,user_Name,passwrod
loginasp 页面代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="/Connections/connectionasp" -->
<!--连接数据库的connectionasp文件包含进来-->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (RequestQueryString("user_Id") <> "") Then
Recordset1__MMColParam = RequestQueryString("user_Id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd2
Dim Recordset1_numRows
Set Recordset1_cmd = ServerCreateObject ("ADODBCommand")
Recordset1_cmdActiveConnection = MM_connection_STRING
Recordset1_cmdCommandText = "SELECT FROM dboUser_info WHERE user_Id = '"& RequestForm("username") &"'""<!--注意改下你的表,建议不要改,把你的数据库设置成这个样子,不然要改好多地方-->
Set Recordset1 = Recordset1_cmdExecute
Recordset1_numRows = 0
%>
<%
' Validate request to log in to this site
MM_LoginAction = RequestServerVariables("URL")
If RequestQueryString <> "" Then MM_LoginAction = MM_LoginAction + "" + ServerHTMLEncode(RequestQueryString)
MM_valUsername = RequestForm("username")
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
Dim shenfen
Dim mingzi
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "####asp"<!--连接成功转至页面-->
MM_redirectLoginFailed = "loginasp"<!--连接不成功转至页面-->
MM_loginSQL = "SELECT user_Id,passwrod"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dboUser_info WHERE user_Id = AND passwrod = "
Set MM_rsUser_cmd = ServerCreateObject ("ADODBCommand")
MM_rsUser_cmdActiveConnection = MM_connection_STRING
MM_rsUser_cmdCommandText = MM_loginSQL
MM_rsUser_cmdParametersAppend MM_rsUser_cmdCreateParameter("param1", 200, 1, 10, MM_valUsername) ' adVarChar
MM_rsUser_cmdParametersAppend MM_rsUser_cmdCreateParameter("param2", 200, 1, 20, RequestForm("password")) ' adVarChar
MM_rsUser_cmdPrepared = true
Set MM_rsUser = MM_rsUser_cmdExecute
If Not MM_rsUserEOF Or Not MM_rsUserBOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If MM_valUsername <>"" Then
shenfen = Recordset1FieldsItem("status")Value
mingzi = Recordset1FieldsItem("user_Name")Value
session("shenfen")=shenfen
session("mingzi")=mingzi
End If
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUserFieldsItem(MM_fldUserAuthorization)Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(RequestQueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = RequestQueryString("accessdenied")
End If
MM_rsUserClose
ResponseRedirect(MM_redirectLoginSuccess)
End If
MM_rsUserClose
ResponseRedirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 10 Transitional//EN" ">
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)