﻿<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<%'============================================================
' Copyright 2007-09 燃点真情. All Rights Reserved.
' Last Update: 2008-3-22  13:28
' ADD:wap.nowtx.cn
' E-Mail: xivn@163.com  QQ:531233814
'============================================================
%>
<%
dim mesall,tid,TP,txts
mesall = Trim(Request.Form("mesall"))
tid = Trim(Request("tid"))
TP=Trim(Request("TP"))
if tid="" or Isnumeric(tid)=False  then
Call Error("card title='提交错误'><p>ID无效！")
end if
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select * from sell where id="&tid,conn,1,1
if rs.eof then
  Call Error("card title='提交错误'><p>帖子不存在！")
  end if
  sellname=rs("name")
  rs.close
  set rs=nothing
if TP<>"" then

txts="推荐帖子[br](url=/bbs/topic.asp?tid="&tid&"&amp;sid=[sid])"&sellname&"(/url)"

dim objgbrs,ids
 set objgbrs=Server.CreateObject("ADODB.Recordset")
  objgbrs.open"select * from myfriend where cid="&myid&" order by id desc",conn,1,1
 Do While Not objgbrs.EOF
      ids=objgbrs("did")
      qfmsg
     objgbrs.MoveNext
  Loop
objgbrs.close
set objgbrs=nothing
Function qfmsg()
  sql="insert into guest(fid,sid,fnr) values ("
  sql=sql & sqlstr(myid) & ","
  sql=sql & sqlstr(ids) & ","
  sql=sql & sqlstr(txts) & ")"
  Application.Lock
  conn.execute(sql)
  Application.Unlock
End function
function sqlstr(data)
sqlstr="'" & Replace(data,"'","'") & "'"
End function

Else

if mesall="" then
  conn.close
  set conn=Nothing
  response.write "<card id='nowtx' ontimer='irecommend.asp?tid="&tid&"&amp;sid="&sid&"' title='提交错误'>"
  response.write "<timer value='10'/><p>您至少要选择一个好友!</p></card></wml>"
  response.end
end if

if IsNumeric(Replace(mesall,";",""))=False then
  conn.close
  set conn=Nothing
  response.write "<card id='nowtx' ontimer='irecommend.asp?tid="&tid&"&amp;sid="&sid&"' title='提交错误'>"
  response.write "<timer value='10'/><p>提交错误…</p></card></wml>"
  response.end
end if

if left(mesall,1)=";" then
mesall=mid(mesall,2)
end if

dim splmesall,s
splmesall=split(mesall,";")

dim total
total = 0

for s = 0 to ubound(splmesall)

'发信
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from guest",conn,1,2
rs.addnew
rs("fnr")="推荐帖子[br](url=/bbs/topic.asp?tid="&tid&"&amp;sid=[sid])"&sellname&"(/url)"
rs("sid")=splmesall(s)
rs("fid")=myid
rs.update

 total = total + 1
  rs.Close
next
set rs=Nothing

End if
conn.close
set conn=Nothing

  response.write "<card id='nowtx' ontimer='topic.asp?tid="&tid&"&amp;sid="&sid&"' title='推荐成功'>"
Response.write "<timer value='20'/>"&chr(13)
Response.write "<p>推荐成功！"&chr(13)
Response.write "<br/><a href='topic.asp?tid="&tid&"&amp;sid="&sid&"'>返回主贴</a>" & chr(13)
%>
<!--#include file="fanhui.asp"-->
</p></card>
</wml>