<!-- #Include File="Include/Config.asp" -->
<%

'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

tit_fir=Cls.ChannelName
call bbs_list_load()
tit="购买贴子 - "&dim_topic(1,0)
If login_mode="" Then
  Call Cls.Out_Msg("您现在还没有登陆本站！\n\n请先注册并登陆本站。","javascript:window.close()")
End If
Call DoWebHead(0,0)
Cls.LoadTemplate(4)
Response.write Cls.ReHtml(ShowWebHead(1),1)
'----------------------------左边 开始----------------------------
response.write vbcrlf&"<table border=0 cellspacing=1 cellpadding=2 class=bbs_tables>" & _
               vbcrlf&"<tr ><td width='100%' align=center>" 
call pay_special_buy()
response.write vbcrlf&"</td></tr>" & _
               vbcrlf&"</table>"
'----------------------------中间 结束----------------------------
Response.write Cls.ReHtml(ShowWebEnd(1),1)
Call DoWebEnd()
sub pay_left()
  dim tmpdim,tmpdim2,tmpnum,n
  tmpnum=0
  tmpdim=split(dim_topic(13,0),",")
  if dim_topic(13,0)<>"" then tmpnum=ubound(tmpdim)+1
%>
<table cellspacing=1 cellpadding=4 class=bbs_tables>
<tr><td class=bbs_td colspan=2>已购买用户信息(共<%=tmpnum%>人)</td></tr>
<tr class=bbs_trp align=center>
<td width='40%'>购买用户</td>
<td width='60%'>购买时间</td>
</tr>
<%
  for n=0 to ubound(tmpdim)
    if instr(tmpdim(n),"|")=0 then tmpdim(n)=tmpdim(n)&"|"
    tmpdim2=split(tmpdim(n),"|")
%>
<tr  class=bbs_trt align=center>
<td><%=format_user_name(tmpdim2(0),0,"")%></td>
<td><%
    if tmpdim2(1)="" then
      response.write "<font class=Gys>非限制用户</font>"
    else
      response.write "<font class=tims>"&Cls.time_type(tmpdim2(1),3)&"</font>"
    end if
%></td></tr>
<%
  next
%>
</table>
<%
  response.write ukong
  if isarray(tmpdim2) then erase tmpdim2
  erase tmpdim
end sub
sub pay_special_buy()
  pageurl="?id="&viewid&"&"
  if int(dim_topic(11,0))=0 then
    Response.Write Cls.js_put("alert(""当前贴子不是购买贴！您无需进行购买!"");window.close();",1)
    exit sub
  end if
  dim tmpdim,tmptrue,tmpdata
  tmpdim=split(dim_topic(12,0),",")
  if Cls.chk then
    tmpdata=dim_topic(13,0)
    if tmpdata<>"" then
      if instr(1,","&tmpdata&",",","&login_username&",",1)>0 or instr(1,","&tmpdata&"|",","&login_username&"|",1)>0 then
        Response.Write Cls.js_put("alert(""您好像已经购买过本贴内容！无需再次购买!"");window.close();",1)
        exit sub
      end if
    end if
    tmptrue=false
    if int(login_emoney)>=int(tmpdim(1)) and int(login_integral)>=int(tmpdim(2)) then tmptrue=true
    if not tmptrue then
      erase tmpdim
      Response.Write Cls.js_put("alert(""您当前的用户分值不足以购买本贴内容！"");window.close();",1)
      exit sub
    end if
    if tmpdata="" then
      tmpdata=login_username&"|"&Cls.now_time
    else
      tmpdata=tmpdata&","&login_username&"|"&Cls.now_time
    end if
    call Cls.exec("insert into AsaiMHnotes(username,nsort,iid,emoney,tim) values('"&login_username&"','Bbs',"&viewid&","&tmpdim(1)&",'"&Cls.now_time&"')",0)    '论坛购买后写入消费记录
    sql="update AsaiMHUserData set emoney=emoney-"&tmpdim(1)&",integral=integral-"&tmpdim(2)&" where id="&login_id
    call Cls.exec(sql,0)
    sql="update AsaiMHUserData set emoney=emoney+"&tmpdim(1)&",integral=integral+"&tmpdim(2)&" where username='"&dim_topic(15,0)&"'"
    call Cls.exec(sql,0)
    sql="update AsaiMHBbstopic set t_special_data='"&tmpdata&"' where id="&viewid
    call Cls.exec(sql,0)
    erase tmpdim
    'Response.Write Cls.js_put("alert(""您已成功购买了本贴内容！\n\n请刷新页面查看您所购买的帖子！"");window.close();",1)
    Response.Write Cls.js_put("alert(""您已成功购买了本贴内容！\n\n点击查看您刚才购买的帖子！"");opener.window.location.reload();window.close();",1)
    'Response.Write Cls.js_put("alert(""您已成功购买了本贴内容！\n\n点击查看您刚才购买的帖子！"");window.opener.location.href=window.opener.location.href;window.close();",1)
    exit sub
  end if
%>
<table cellspacing=1 cellpadding=4 class=bbs_tables>
<tr><td class=bbs_td colspan=2>个人信息</td></tr>
<tr class=bbs_tr>
<td width="40%">用户名：</td>
<td width="60%"><%=format_user_name(login_username,0,"")%></td>
</tr>
<tr class=bbs_tr>
<td>货&nbsp;&nbsp;&nbsp;币：</td>
<td><font class=red><%=int(login_emoney)%></font>&nbsp;<%=Cls.web_unit%></td>
</tr>
<tr class=bbs_tr>
<td>积&nbsp;&nbsp;&nbsp;分：</td>
<td><font class=red><%=int(login_integral)%></font>&nbsp;分</td>
</tr>
<tr class=bbs_tr>
<td>体&nbsp;&nbsp;&nbsp;力：</td>
<td><font class=red><%=int(login_strength)%></font>&nbsp;点</td>
</tr>
<tr class=bbs_tr>
<td>经&nbsp;&nbsp;&nbsp;验：</td>
<td><font class=red><%=int(login_expression)%></font>&nbsp;点</td>
</tr>
<tr class=bbs_tr>
<td>发&nbsp;&nbsp;&nbsp;贴：</td>
<td><font class=red><%=int(login_bbs_counter)%></font>&nbsp;贴</td>
</tr>
<tr class=bbs_tr>
<td>在&nbsp;&nbsp;&nbsp;线：</td>
<td><font class=red><%=int(User_OnlineTime)%></font>&nbsp;分钟</td>
</tr>
</table>
<%=ukong%>
<table cellspacing=1 cellpadding=4 class=bbs_tables>
<tr><td class=bbs_td><%=Cls.code_html(tit,1,26)%></td></tr>
<tr class=bbs_trb><td align=center><b>购买本贴内容需要满足一下条件：<b></td></tr>
<tr class=bbs_tr><td align=center>
  <table border=0>
  <tr><td>货币 <font class=red><%=tmpdim(1)%></font> <%=Cls.web_unit%></td></tr>
  <tr><td>积分 <font class=red><%=tmpdim(2)%></font> 分</td></tr>
  </table>
</td></tr>
<form name=frm_pay action="pay.asp?id=<%=viewid%>" method=post onsubmit="javascript:frm_submitonce(this);">
<input type=hidden name=chk value=yes>
<tr><td class=bbs_trb align=center><input type=submit class=btn value="我确定要购买此贴" onclick="javascirpt:return click_return('现在立即购买此贴',2);"></td></tr>
</form>
</table>
<%=ukong%>
<%
end sub
%>
