<%
response.cookies("subperiod")=""
Dim Str2, Str3, agent, discuz_auth_key, new_bbs_user_info, tmp_ar
Const Key="ca6c55FylvPUNXlf"
agent=request.servervariables("http_user_agent")
discuz_auth_key=Php_MD5(Key & agent)
Str2=request.cookies("aSr_auth")
On Error Resume next
Str3=uc_authcode(Str2,"DECODE",discuz_auth_key)
If Len(Trim(Str3))<2 Then
%>
<%
Else
If Len(Trim(Str3))>0 And Err.number=0 then
tmp_ar=Split(Str3,Chr(9))
new_bbs_user_info=tmp_ar(2)
' 利用xmlhttp通过user_id获得username
DIM Http
DIM username
DIM URL
Set Http = SERVER.CREATEOBJECT("Microsoft.XMLHTTP")
URL = "http://bbs.21ic.com/api/dl_api.php?user_id=" & new_bbs_user_info
Http.Open "GET",URL,FALSE
Http.send(null)
Dim ArrHttp,ai
ArrHttp = Split(Http.ResponseText,"""")
username = ArrHttp(7)
response.cookies("cypress")("user_id") = ArrHttp(3)
response.cookies("cypress")("username") = ArrHttp(7)
Set Http = Nothing
If Len(Trim(ArrHttp(3)))>0 And Len(Trim(username))>0 then
ConnectDatabase
Dim rs, sqlstr
set rs = server.createobject("adodb.recordset")
sqlstr="select * from [users] where username='" & username & "' and ans_company='cypress'"
rs.CursorLocation=3
rs.open sqlstr,myconn,1,3
if rs.bof or rs.eof Then
rs.addnew
rs("bbs_userid") = ArrHttp(3)
rs("username") = username
rs("ans_company") = "cypress"
rs("accessip")= Request.ServerVariables("REMOTE_ADDR")
rs.update
end If
rs.close
Set rs=Nothing
CloseDatabase
End if
End If
%>
<% End if%>