?? userlogin.asp
字號:
<!--#include file="Conn.asp"-->
<%
'********************************************************
'用戶登錄成功處理
'*******************************************************
Sub UserEnter(userid,flag)
dim connEnter
dim strSQL
if trim(userid)="" then
exit sub
end if
'會員登錄進(jìn)來啦
if flag="1" then
session("UserID")=trim(userid)
'從用戶表中提取用戶信息
set rec=server.createobject("adodb.recordset")
strsql="select * from userinfo where txtId='" & userid & "'"
rec.open strsql,conn,1,1
if not rec.eof then
'用戶信息提取
session("txtClass")=rec("txtClass")
session("userlogin")="ok"
rec.close
set rec=nothing
end if
end if
END Sub
'******************
'檢測用戶帳號是否已經(jīng)開通
'******************
Function CheckUserIdBegin(Uid)
set rsUser=server.CreateObject("ADODB.recordset")
strSQL="select Flag from Userinfo where txtId='"&Uid&"'"
rsUser.Open strSQL,conn,1,1
CheckUserIdBegin=rsUser("Flag")
rsUser.Close
End Function
userid=trim(Request("userid"))
password=trim(request("password"))
'判斷接受的帳號\密碼是否符合要求
if userid="" then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得為空!');window.history.go(-1);}</script>"
end if
if instr(1,userid,",")>=1 then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得包含逗號!');window.history.go(-1);}</script>"
end if
if instr(1,userid,"'")>=1 then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得包含單引號!');window.history.go(-1);}</script>"
end if
if instr(1,password,",")>=1 then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得包含逗號!');window.history.go(-1);}</script>"
end if
if instr(1,password,"'")>=1 then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得包含單引號!');window.history.go(-1);}</script>"
end if
if instr(1,password,"*")>=1 then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得包含*!');window.history.go(-1);}</script>"
end if
if instr(1,password,"$")>=1 then
Response.Write "<script language=JavaScript>{window.alert('登錄帳號不得包含$!');window.history.go(-1);}</script>"
end if
'判斷帳號及密碼是否正確
set recCheckUser=server.CreateObject("ADODB.recordset")
uid=trim(Request("userid"))
upwd=trim(Request("password"))
strSQL="select * from userinfo where txtId='" & uid & "' and txtPass='" & upwd & "'"
recCheckUser.Open strSQL,conn
if not recCheckUser.EOF then
'如果用戶帳號及密碼正確
'檢測用戶帳號是否審核通過或被鎖定
If CheckUserIdBegin(Uid)=0 Then
Response.Write "<script language=JavaScript>{window.alert('此會員帳號尚未通過驗證,請確認(rèn)您已經(jīng)加納會費,若是,請盡快與我們聯(lián)系!');window.history.go(-1);}</script>"
response.end
End If
'用戶進(jìn)入
call UserEnter(uid,1)
Response.Write "<script language=JavaScript>{window.alert('登錄成功!');window.location.href='default.asp';}</script>"
Response.End
else
'用戶帳號及密碼不正確
recCheckUser.Close
set recCheckUser=nothing
set conn=nothing
Response.Write "<script language=JavaScript>{window.alert('您輸入的帳號及密碼錯誤,請重新輸入!');window.history.go(-1);}</script>"
end if
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -