<!--#include file="Conn.asp"-->
<!-- #include file="inc/const.asp" -->
<%
Response.write"<?xml version=""1.0"" encoding=""gb2312""?>"
Response.write"<stardy>"
call Main()
Response.write "</stardy>"
Sub Main
	Dim MemberName,SQL,sendmsgnum,sendmsgid,sendmsguser,rs,MessDB,CacheName
	If Request.querystring()="6" Then 
		MessDB="Message"
		MemberName=Request.Cookies("aspsky")("username")
	Elseif Request.querystring()="7.1" then
		MessDB="DV_Message"
		CacheName=Replace(Replace(Replace(Server.MapPath("index.asp"),"index.asp",""),":",""),"\","")
		If IsArray(Session(CacheName & "UserID")) Then 
			If Ubound(Session(CacheName & "UserID"))>=4 Then MemberName =  Session(CacheName & "UserID")(5)
		End If
	else 
		MessDB="DV_Message"
		MemberName =  Dvbbs.MemberName
	End If
	If MemberName="" Then Response.write"<sts>-1</sts>":Exit Sub
	If Request.querystring()<>"6" Then ConnectionDataBase
	Sql="SELECT Count(ID) FROM "&MessDB&" WHERE flag=0 And issend=1 And DelR=0 And incept='"& MemberName &"'"
	sendmsgnum=Conn.Execute(Sql)(0)
	If sendmsgnum>0 Then
		Sql="SELECT top 1 id,sender FROM "&MessDb&" WHERE flag=0 And issend=1 And DelR=0 And incept='"& MemberName &"' order by id"
		set rs=Conn.Execute(Sql)
		sendmsgid=rs(0)
		sendmsguser=rs(1)
		Response.write"<sts>ok</sts><num>"&sendmsgnum&"</num><id>"&sendmsgid&"</id><sender>"&sendmsguser&"</sender>"
	Else
		Response.write"<sts>0</sts>"
	End If
End Sub
conn.close
%>