本类搜索:

读取QQ是否在线的ASP程序

2008-6-11 19:38:45 作者: allenjen 来源: 金龙网站设计工作室

QQ.ASP <PRE id=code><FONT id=code face="Verdana, Arial" size=1>
<%@Language=VBScript%>
<%

http://aboutcn.com ;

Dim qq, style, set_on, set_off, mode, limituse, limitnumber, imgurl, self_online, self_offline
Dim line, data, out, temp1, temp2, temp3, online, offline
Dim img, text

qq = Request.QueryString("qq")
style = Request.QueryString("style")
set_on = Request.QueryString("on")
set_off = Request.QueryString("off")
mode = Request.QueryString("mode")
If set_on <> "" Or set_off <> "" Then style = "set"

Set Fs = Server.CreateObject("Scripting.FileSystemObject")
filepath = Server.MapPath("config.asp")
Set File = Fs.OpenTextFile(filepath, 1, False)
Do
line = File.ReadLine
line = Replace(line, Chr(10), "")
line = Replace(line, Chr(13), "")
line = Replace(line, ";", "")
line = Replace(line, ",", "")
line = Replace(line, " ", "")
line = Replace(line, Chr(34), "")
line = Replace(line, " ", "")
data = Split(line, "=")
Select Case data(0)
Case "limituse":
limituse = data(1)
Case "limitnumber":
limitnumber = Split(data(1), ",")
Case "imgurl":
imgurl = data(1)
Case "self_online":
self_online = data(1)
Case "self_offline":
self_offline = data(1)
Case Else:
End Select
Loop Until File.AtEndOfStream
File.close
Set Fs = Nothing
Set File = Nothing

img = imgurl & "/unreg.gif"
text = "不在线上。"
If AllowUse() Then
out = GetHtml()
If out <> "" Then
temp1 = Split(out, "ShowResult")
temp2 = Split(temp1(2), "</script>")
temp3 = Split(temp2(0), Chr(34) & "," & Chr(34))
out = temp3(1)

If out <> "" Then
Select Case style
Case "1", "2", "3", "4", "5", "6", "7", "8", "9", "10":
online = imgurl & "/online" & style & ".gif"
offline = imgurl & "/offline" & style & ".gif"
Case "l", "L":
online = out
online = Replace(online, "/l/", "/s/")
online = Replace(online, "-0", "-2")
online = Replace(online, "-1", "-3")
offline = online
Case "s", "S":
online = out
offline = online
Case "set", "SET":
If set_on = "" Then
set_on = self_online
End If
If set_off = "" Then
set_off = self_offline
End If
online = set_on
offline = set_off
Case Else:
online = imgurl & "/online0.gif"
offline = imgurl & "/offline0.gif"
End Select

If Instr(out, "-2") <> 0 Then
img = online
text = "正在线上!"
Else
img = offline
End If
End If
End If
End If

If mode = "script" Then
Response.Write
"document.write(<a target=_blank
href=" & Chr(34) & "http://search.tencent.com/cgi-bin/friend/user_show_info?ln=" & qq & Chr(34) & "
title=" & Chr(34) & "我的QQ号码是 " & qq & " ,目前" & text & Chr(34) & "><img src=" & Chr(34) & img & Chr(34) & " border=0></a>);"
Else
Response.Redirect img
End If

Function GetHtml
Set Receive = CreateObject("Microsoft.XMLHTTP")
With Receive
.Open "GET", "http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no=" & qq, False, "", ""
.Send
GetHtml = .ResponseText
End With
Set Receive = Nothing
End Function

Function AllowUse
Dim i
If limituse = 0 Then
AllowUse = True
Else
AllowUse = False
For i = 0 To UBound(limitnumber)
If qq = CStr(limitnumber(i)) Then
AllowUse = True
End If
Next
End If
End Function
%>
</FONT></PRE>CONfig.asp <PRE id=code><FONT id=code face="Verdana, Arial" size=1>limituse = 0
limitnumber = 107625796,57817108
imgurl = http://www.mydomain.com/addon/qq/img
self_online = http://www.mydomain.com/addon/qq/img/0-0.gif
self_offline = http://www.mydomain.com/addon/qq/img/0-1.gif
</FONT></PRE>使用方法:
<SCRIPT src="http://www.aboutcn.com/addon/qq/qq.asp?qq=107625796&amp;style=1&amp;mode=script"></SCRIPT>
[在线编辑:allenjen][打印本页][收藏本页][关闭本页]
免责声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。对本文有异议,请联络本站!
转载要求:文章作者及来源信息必需保留。转载之图片、文件,链接请不要盗链到本站地址,且不准打上各自站点的水印。
本类最新
关于我们  |  广告服务  |  版权声明  |  支付方式  |  联系我们  |  建站流程  |  网站导航  |  加入收藏
网站合作、内容监督、商务咨询、投诉建议:13459049164

Copyright©2008-2009厦门金龙网站设计工作室(网站建设)版权所有
赣ICP备08000130号
赣ICP备08000130号