<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<%call head()
call Fortxtmsg
Call saycarda("查看消息")
Dim urls1

urls1=Request.Querystring("url")
If urls1="" Then urls1="index.asp"
If instr(urls1,"@@")>0 or instr(urls1,"?")>0 Then
urlsid="@@sid="&sid&""
Else
urlsid="?sid="&sid&""
End if

dim id
id=request("id")
if id="" or Isnumeric(id)=False then id=0
'检查留言是否已经满
if keys > 0 or skey>0 then
  guestcount = keymsgcount      '社区管理员和版主信箱储存数
else
  guestcount = msgcount      '普通会员信箱储存数
end if
dim Count1,Count2,Count
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "SELECT ID from Guest where sid="&myid&" and fzt = 1 and sdel=0",conn,1,1
Count1=rs.RecordCount
rs.close
rs.open "SELECT ID from Guest where fid="&myid&" and fzt = 1 and fdel=0",conn,1,1
Count2=rs.RecordCount
Count=Count1+Count2
if clng(Count) >= abs(int(guestcount)) then
  rs.close
  set rs=Nothing
  conn.close
  set conn=Nothing
  response.write "你的信箱已满，需要清空旧消息后才可以查看留言！"

  response.write "<br/><a href=""msgalldel.asp?sid="&sid&"&amp;saytk="&saytk&""">马上清空旧消息</a>"

if saytk=1 then
  response.write "<br/><anchor><prev/>取消</anchor>"
end if
call head1()
  response.end
end if
rs.close
set rs=nothing

set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select top 1 id,fnr,fid,sid,tou,ftm from guest where sdel=0 and  fzt=0 and sid="&myid&" order by ID asc",conn,1,1
if rs.eof then
response.write "没有新信息了<br/>"
else
dim ids,sendtxt,ftm,guestid
guestid=rs("ID")
sendtxt=rs("fnr")
biao=rs("tou")
ids=rs("fid")
ftm=rs("ftm")
rs.close
set rs=nothing
dim username
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select id,name from Users where id="&ids,conn,1,1
if rs.eof then
username=""
Else
username=rs("name")
rs.close
set rs=nothing
end if
conn.Execute("update guest set fzt=1 where id="&guestid)
response.write "内容："
if biao<>0 then
response.write "<img src='face/"&biao&".gif' alt=''/>"
end If
If ids=0 then
response.write ubb2(sendtxt)
Else
response.write usb(sendtxt)
End if

if username<>"" then
response.write "<br/>作者："

response.write "<a href=""uinfo.asp?id="&ids&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"&ubb(username)&"</a>(ID:"&ids&")"

response.write "<br/>时间："&ftm&""
if saytk=>2 then
	Response.write "<form name=""form"" method=""post"" action=""msgaddsave.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;urlss1122="&urls1&""">"
end if
response.write "<br/><select title='表情' name='face' value='0'>"&chr(13)
response.write "<option title='表情' value='0'>表情</option>"&chr(13)
response.write "<option title='微笑' value='1'>微笑</option>"&chr(13)
response.write "<option title='哭泣' value='2'>哭泣</option>"&chr(13)
response.write "<option title='调皮' value='3'>调皮</option>"&chr(13)
response.write "<option title='脸红' value='4'>脸红</option>"&chr(13)
response.write "<option title='害羞' value='5'>害羞</option>"&chr(13)
response.write "<option title='生气' value='6'>生气</option>"&chr(13)
response.write "<option title='偷笑' value='7'>偷笑</option>"&chr(13)
response.write "<option title='流汗' value='8'>流汗</option>"&chr(13)
response.write "<option title='我倒' value='9'>我倒</option>"&chr(13)
response.write "<option title='得意' value='10'>得意</option>"&chr(13)
response.write "<option title='眦牙' value='11'>眦牙</option>"&chr(13)
response.write "<option title='疑问' value='12'>疑问</option>"&chr(13)
response.write "<option title='睡觉' value='13'>睡觉</option>"&chr(13)
response.write "<option title='好色' value='14'>好色</option>"&chr(13)
response.write "<option title='口水' value='15'>口水</option>"&chr(13)
response.write "<option title='敲头' value='16'>敲头</option>"&chr(13)
response.write "<option title='可爱' value='17'>可爱</option>"&chr(13)
response.write "<option title='猪头' value='18'>猪头</option>"&chr(13)
response.write "<option title='YEAH' value='19'>YEAH</option>"&chr(13)
response.write "<option title='玫瑰' value='20'>玫瑰</option>"&chr(13)
response.write "</select>"&chr(13)
if saytk=>2 then
Response.Write "<input name=""txt"" maxlength=""500"" size=""10"" value=""""/><br/>"
response.write "<input type=""hidden"" name=""lid"" value="""&ubb(ids)&"""/>"
else
response.write "<input name='txt"&tt&"' title='内容' type='text' maxlength='500' value=''/><br/>"
end if
if saytk=>2 then

%>

<input type="submit" name="Submit" value="快速回复"></form><br/><%
else
response.write "<anchor>快速回复"
response.write "<go href='msgaddsave.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;urlss1122="&urls1&"' method='post' accept-charset='utf-8'>"
response.write "<postfield name=""txt"" value=""$(txt"&tt&")""/>"
response.write "<postfield name=""lid"" value="""&ubb(ids)&"""/>"
response.write "<postfield name=""face"" value=""$(face)""/>"
response.write "</go></anchor>"
end if
response.write "<a href=""msglist.asp?fid="&ids&"&amp;sid="&sid&"&amp;saytk="&saytk&""">聊天记录</a><br/>"
response.write "<a href=""msgdel.asp?id="&id&"&amp;url="&urls&"&amp;sid="&sid&"&amp;saytk="&saytk&""">删除消息</a><br/>"

else
response.write "<br/>社区系统消息<br/>"
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select id,fid from guest where id="&guestid&" and sid="&myid,conn,1,2
if not rs.eof then
if rs("fid")=0 then
rs.delete
rs.update
end if
end if
rs.close
set rs=nothing
end if

end if
conn.close
set conn=nothing
response.write "<a href=""mymsg.asp?sid="&sid&"&amp;saytk="&saytk&""">我的信箱</a>"
response.write "<br/><a href="""&replace(replace(urls1,"@@","&amp;"),"sidoo","sid")&""">返回来源页</a>"%>
<!--#include file="fanhui.asp"-->
<%call head1()%>