?? login.asp
字號:
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
background-color: #B1DB99;
}
-->
</style><!--#Include file="inc/conn.asp" -->
<%
Dim strUsername ,strUserPwd ,strUserType ,strTableName
strUsername = Trim(Request.Form("UserName"))
strUserPwd = Trim(Request.Form("Password"))
strUserType = Trim(Request.Form("Usertype"))
If strUserType = "學生" Then
strTableName = "Student"
ElseIf strUserType = "教師" Then
strTableName = "Teacher"
ElseIf strUserType = "管理員" Then
strTableName = "Admin"
End If
If strTableName ="" Then
Response.Write("參數出錯!")
Response.End
End If
Dim rs ,strSql
Set rs = Server.CreateObject("ADODB.Recordset")
If strTableName = "Student" Then
strSql = "SELECT * FROM "& strTableName &" WHERE (Name = '"& strUsername &"' OR SNO = "& strUserName &" ) AND Pwd = '"& strUserPwd &"'"
ElseIf strTableName = "Teacher" Then
strSql = "SELECT * FROM "& strTableName &" WHERE (Name = '"& strUsername &"' OR TNO = "& strUserName &" ) AND Pwd = '"& strUserPwd &"'"
Else
strSql = "SELECT * FROM "& strTableName &" WHERE Name = '"& strUsername &"' AND Pwd = '"& strUserPwd &"'"
End If
rs.open strSql,conn,1,1
If rs.EOF or rs.BOF Then
Response.Write("<BR><BR><BR><Div align=center>登錄失敗,用戶不存在或密碼錯誤!<Br><BR><a href=index.asp>重新登錄</a></div>")
Response.End
Else
Session("ID") = rs("ID").value
Session("UserName") = rs("Name").value
Session("UserType") = strUserType
Response.Redirect("Main.asp")
End If
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -