整合问题
<!--#include file="inc/config.asp"-->
<!--#include file="dv_dpo/Cls_DvApi.asp" -->
<%
dim act,user,pwd,lrs,lsql
act=request("action")
user=replace(trim(request("name")),"'","‘")
pwd=replace(trim(request("pwd")),"'","‘")
set lrs =server.createObject("adodb.recordset")
lsql="select * from [user] where name='"&User&"' and pwd='"&pwd&"'"
lrs.open lsql,conn,1,3
'response.end
if lrs.eof then
'response.write sql
response.write "<script language='javascript'>alert('用户名或密码错误!请重新登陆!');history.back();</script>"
response.end
else
'Dim DvApi_Obj,DvApi_SaveCookie,SysKey
If DvApi_Enable Then
Set DvApi_Obj = New DvApi
DvApi_Obj.NodeValue "action","login",0,False
DvApi_Obj.NodeValue "username",user,1,False
Md5OLD = 1
SysKey = Md5(DvApi_Obj.XmlNode("username")&DvApi_SysKey,16)
Md5OLD = 0
DvApi_Obj.NodeValue "syskey",SysKey,0,False
DvApi_Obj.NodeValue "password",pwd,0,False
DvApi_Obj.SendHttpData
If DvApi_Obj.Status = "1" Then
Response.write("<script>alert(""" & DvApi_Obj.Message & """);history.go(-1);</script>")
Response.End()
Else
DvApi_SaveCookie = DvApi_Obj.SetCookie(SysKey,user,MD5(pwd,16),"")
End If
Set DvApi_Obj = Nothing
End If
'-----------------------------
'系统整合:输出登录JavaScript
'-----------------------------
If DvApi_Enable Then
Response.Write DvApi_SaveCookie
'Response.Flush()
End If
'-----------------------------
'跳转不能直接用Response.redirect("index.asp"),否则上边输出JS没效果
response.cookies("xinyou88")("domain")=Request.ServerVariables("SERVER_NAME")
response.cookies("xinyou88")("user")=user
response.cookies("xinyou88")("password")=pwd
dlcs=lrs("dlcs")
dlcs=dlcs+1
lrs("dlcs")=dlcs
lrs("zhdl")=now()
lrs("zhip")=request.serverVariables("remote_host")
lrs.update
Response.Write "<script language='javascript'>window.location=""index.asp"";</script>"
end if
lrs.close
set lrs=nothing
response.end
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
Public Function SetCookie(Byval C_Syskey,Byval C_UserName,Byval C_PassWord,Byval C_SetType)
Dim i,TempStr
TempStr = ""
For i = 0 to Ubound(ArrUrls)
TempStr = TempStr & vbNewLine & "<script language=""JavaScript"" src="""&Trim(ArrUrls(i))&"?syskey="&Server.URLEncode(C_Syskey)&"&username="&Server.URLEncode(C_UserName)&"&password="&Server.URLEncode(C_PassWord)&"&savecookie="&Server.URLEncode(C_SetType)&"""></script>"
Next
SetCookie = TempStr
End Function
哪位高人能说明一下,为何上面的Response.Write DvApi_SaveCookie写进内容呢
------解决方案--------------------
道理很简单。
因为DvApi_SaveCookie 只个过程(函数),全部写好了,这里调用即可。