<!-- #include file="setup.asp" -->
<%
id=int(Request("id"))
dim szhotdog_sppost
sql="select content,username,forumid from [forum] where ID="&ID&" and deltopic<>1"
if Request.Cookies("username")=empty then
content="<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <a href=login.asp>登录</a> <font color=#666666>后才能浏览</font><hr></td></tr></table><br>"
else
if request("menu")="buy" then
if Request.ServerVariables("request_method") <> "POST" then
response.write "<form name=BBSxpPOST method=post action=sppost.asp?"&Request.ServerVariables("Query_String")&"></form><SCRIPT>if(confirm('您确定要执行该操作?')){returnValue=BBSxpPOST.submit()}else{returnValue=history.back()}</SCRIPT>"
htmlend
end if
rs.open sql,conn,1,3
content=rs("content")

contentT1=split(content,"[buy=")
contentT2=replace(content,contentT1(0)&"[buy=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
guy=replace(split(content,"[/guy]")(0),split(content,"[guy]")(0)&"[guy]","")
	if instr("|"&guy&"|","|"&Request.Cookies("username")&"|")>0 then
	rs.close
	error2("您已经购买了此贴")
	else
	if conn.execute("select [money] from [user] where username='"&Request.Cookies("username")&"'")(0)<int(check) then error2("您没有足够的金币")
	rs("content")=replace(content,"[guy]"&guy&"[/guy]","[guy]"&guy&"|"&Request.Cookies("username")&"[/guy]")
	rs.update
	conn.execute("update [user] set [money]=[money]+"&int(check)&" where username='"&rs("username")&"'")
	conn.execute("update [user] set [money]=[money]-"&int(check)&" where username='"&Request.Cookies("username")&"'")
	end if
else
erro2("非法购买命令")
end if

rs.close
set rs=nothing
set conn=nothing
response.redirect ("ShowPost.asp?id="&id)
end if

'**********特殊帖
set rs=conn.execute(sql)
content=rs("content")
dim check
Set re = New RegExp
re.IgnoreCase =True
re.Global=True

'On Error Resume Next
'*********	回复贴
if instr(lcase(content),"[replyview]")>0 then
re.Pattern="(\[replyview\])(.*)(\[/replyview\])"
filtrate=split(content,"[/replyview]")
if (not conn.execute("select username from [reforum] where topicid="&id&" and username='"&Request.Cookies("username")&"'").eof) or rs("username")=Request.Cookies("username") then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/replyview]","<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>回复</b></font> <font color=#666666>后才能浏览</font><br>$2<hr></td></tr></table><br>")
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/replyview]","<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>回复</b></font> <font color=#666666>后才能浏览</font><hr></td></tr></table><br>")
next
end if
content=replace(contentT,"[/replyview]","")
end if

'*********	购买贴
if instr(lcase(content),"[buy=")>0 then
guy=replace(split(content,"[/guy]")(0),split(content,"[guy]")(0)&"[guy]","")
re.Pattern="(.*)(\[buy=)(\d*)(\])(.*)(\[/buy\])(.*)"
filtrate=split(content,"[/buy]")
contentT=""
contentT1=split(content,"[buy=")
contentT2=replace(content,contentT1(0)&"[buy=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
check=int(check)
if instr("|"&guy&"|","|"&Request.Cookies("username")&"|")>0 or rs("username")=Request.Cookies("username") or instr("|"&Conn.Execute("Select moderated From [bbsconfig] where id="&rs("forumid")&" ")(0)&"|","|"&Request.Cookies("username")&"|")>0 or membercode>3 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/buy]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>支付金币："&check&"</b></font> <font color=#666666>后才能浏览</font><br>$5<hr></td></tr></table><br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/buy]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>支付金币："&check&"</b></font> <font color=#666666>后才能浏览<br>再不付，以后要涨价罗！</font><br><input name=buytopic type=button value=""真黑呀,我买了"" onClick=""window.location=\'sppost.asp?menu=buy&id="&id&"\'""></font><br><hr></td></tr></table><br>$7") 
next
end if
content=replace(contentT,"[/buy]","")

re.Pattern="(\[guy\])(.*)(\[/guy\])"
content=re.replace(content,"")
content=replace(content,"[guy]"&guy&"[/guy]","")
end if
'content=re.replace(content,"<div align=right><hr width=80% noshade>授权用户:$2<div>")
'content=content&"<br><hr noshade size=1>授权用户:"&guy(0)
end if

'*********	经验贴
if instr(lcase(content),"[point=")>0 then
re.Pattern="(.*)(\[point=)(\d*)(\])(.*)(\[/point\])(.*)"
filtrate=split(content,"[/point]")
contentT=""
contentT1=split(content,"[point=")
contentT2=replace(content,contentT1(0)&"[point=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
if check>0 then
check=int(check)
if conn.execute("select experience from [user] where username='"&Request.Cookies("username")&"'")(0)>check or rs("username")=Request.Cookies("username") or instr("|"&Conn.Execute("Select moderated From [bbsconfig] where id="&rs("forumid")&" ")(0)&"|","|"&Request.Cookies("username")&"|")>0 or membercode>3 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/point]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>经验>"&check&"</b></font> <font color=#666666>后才能浏览</font><br>$5<hr></td></tr></table><br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/point]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>经验>"&check&"</b></font> <font color=#666666>后才能浏览</font><br><hr></td></tr></table><br>$7") 
next
end if
content=replace(contentT,"[/point]","")
end if
end if
end if

'*********	帮派贴
if instr(lcase(content),"[fact=")>0 then
re.Pattern="(.*)(\[fact=)(.*)(\])(.*)(\[/fact\])(.*)"
filtrate=split(content,"[/fact]")
contentT=""
contentT1=split(content,"[fact=")
contentT2=replace(content,contentT1(0)&"[fact=","")
check=split(contentT2,"]")(0)
set rs1=conn.execute("select id,factionname from [faction] where factionname='"&check&"'")
if not rs1.eof then
if conn.execute("select faction from [user] where username='"&Request.Cookies("username")&"'")(0)=check or rs("username")=Request.Cookies("username") or membercode>3 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/fact]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>加入 <a href=faction.asp?menu=look&id="&rs1("id")&">"&check&"</a> 帮派</b></font></a> <font color=#666666>后才能浏览</font><br>$5<hr></td></tr></table><br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/fact]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>加入 <a href=faction.asp?menu=look&id="&rs1("id")&">"&check&"</a> 帮派</b></font></a> <font color=#666666>后才能浏览</font><br><hr></td></tr></table><br>$7") 
next
end if
content=replace(contentT,"[/fact]","")
end if
end if

'*********	现金贴
if instr(lcase(content),"[money=")>0 then
re.Pattern="(.*)(\[money=)(\d*)(\])(.*)(\[/money\])(.*)"
filtrate=split(content,"[/money]")
contentT=""
contentT1=split(content,"[money=")
contentT2=replace(content,contentT1(0)&"[money=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
if check>0 then
check=int(check)
if conn.execute("select money from [user] where username='"&Request.Cookies("username")&"'")(0)>check or rs("username")=Request.Cookies("username") or instr("|"&Conn.Execute("Select moderated From [bbsconfig] where id="&rs("forumid")&" ")(0)&"|","|"&Request.Cookies("username")&"|")>0 or membercode>3 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/money]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>现金>="&check&"</b></font> <font color=#666666>后才能浏览</font><br>$5<hr></td></tr></table><br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/money]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>现金>="&check&"</b></font> <font color=#666666>后才能浏览</font><br><hr></td></tr></table><br>$7") 
next
end if
content=replace(contentT,"[/money]","")
end if
end if
end if

'*********	威望贴
if instr(lcase(content),"[power=")>0 then
re.Pattern="(.*)(\[power=)(\d*)(\])(.*)(\[/power\])(.*)"
filtrate=split(content,"[/power]")
contentT=""
contentT1=split(content,"[power=")
contentT2=replace(content,contentT1(0)&"[power=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
if check>0 then
check=int(check)
if conn.execute("select power from [user] where username='"&Request.Cookies("username")&"'")(0)>check or rs("username")=Request.Cookies("username") or instr("|"&Conn.Execute("Select moderated From [bbsconfig] where id="&rs("forumid")&" ")(0)&"|","|"&Request.Cookies("username")&"|")>0 or membercode>3 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/power]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>威望>="&check&"</b></font> <font color=#666666>后才能浏览</font><br>$5<hr></td></tr></table><br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/power]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>威望>="&check&"</b></font> <font color=#666666>后才能浏览</font><br><hr></td></tr></table><br>$7") 
next
end if
content=replace(contentT,"[/power]","")
end if
end if
end if
'*********	魅力贴
if instr(lcase(content),"[magicpower=")>0 then
re.Pattern="(.*)(\[magicpower=)(\d*)(\])(.*)(\[/magicpower\])(.*)"
filtrate=split(content,"[/magicpower]")
contentT=""
contentT1=split(content,"[magicpower=")
contentT2=replace(content,contentT1(0)&"[magicpower=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
if check>0 then
check=int(check)
if conn.execute("select magicpower from [user] where username='"&Request.Cookies("username")&"'")(0)>check or rs("username")=Request.Cookies("username") or instr("|"&Conn.Execute("Select moderated From [bbsconfig] where id="&rs("forumid")&" ")(0)&"|","|"&Request.Cookies("username")&"|")>0 or membercode>3 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/magicpower]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>魅力>="&check&"</b></font> <font color=#666666>后才能浏览</font><br>$5<hr></td></tr></table><br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/magicpower]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容需要</font> <font color=red><b>魅力>="&check&"</b></font> <font color=#666666>后才能浏览</font><br><hr></td></tr></table><br>$7") 
next
end if
content=replace(contentT,"[/magicpower]","")
end if
end if
end if
'*********	红包贴
if instr(lcase(content),"[rmoney=")>0 then
re.Pattern="(.*)(\[rmoney=)(.*)(\])(.*)(\[/rmoney\])(.*)"
filtrate=split(content,"[/rmoney]")
contentT=""
contentT1=split(content,"[rmoney=")
contentT2=replace(content,contentT1(0)&"[rmoney=","")
check=split(contentT2,"]")(0)
remoney=split(check&",",",")
howmoney=remoney(0)
howguy=remoney(1)
	if isnumeric(howmoney) and isnumeric(howguy) then
	if howmoney>0 and howguy>0 then
	for i = 0 to ubound(filtrate)
	contentT=contentT&re.replace(filtrate(i)&"[/rmoney]","$1<br><table width=80% border=0 cellspacing=0 cellpadding=0 align=center><tr><td><hr><font color=#666666>此内容</font> <font color=red><b>回复</b></font> 可以得到 <font color=red><b>红包</b></font> <br>$5<hr></td></tr></table><br>$7")
	next
	content=replace(contentT,"[/rmoney]","")
	end if
	end if
end if

set re=Nothing
'**********特殊帖END
end if

szhotdog_sppost=content
'If Err Then szhotdog_sppost=rs("content")
%>
<script> 
var guy=""
var list="<%=guy%>".split ('|');
for(i=0;i<list.length;i++) {
if (list[i] !=''){
guy=guy+"<a href=profile.asp?username="+list[i]+">"+list[i]+"</a> "
}}
if (guy!=""){guy='<div align=right><hr width=80% noshade><font color=#666666>授权用户：</font>'+guy+'<div>'}
parent.szhotdog_sppost.innerHTML=ybbcode('<%=szhotdog_sppost%>')+guy
</script>
<%
responseend
%>