?? buypost.asp
字號:
<!-- #include file="conn.asp" -->
<!-- #include file="inc/const.asp" -->
<%
response.buffer=true
dim rootid
dim AnnounceID
stats="購買帖子"
if BoardID="" or not isInteger(BoardID) or BoardID=0 then
Errmsg=Errmsg+"<br>"+"<li>錯誤的版面參數!請確認您是從有效的連接進入。"
founderr=true
else
BoardID=clng(BoardID)
end if
if request("id")="" then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>請指定相關貼子。"
elseif not isInteger(request("id")) then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>非法的貼子參數。"
else
rootid=request("id")
end if
if request("replyID")="" then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>請指定相關貼子。"
elseif not isInteger(request("replyID")) then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>非法的貼子參數。"
else
AnnounceID=request("replyID")
end if
dim FoundTable
FoundTable=false
if request("PostTable")<>"" then
For i=0 to ubound(AllPostTable)
if request("PostTable")=AllPostTable(i) then
FoundTable=true
exit for
end if
next
else
founderr=true
Errmsg=Errmsg+"<br>"+"<li>非法的參數。"
end if
if not FoundTable then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>非法的參數。"
end if
if not founduser then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>請登陸后進行操作。"
end if
if founderr then
call nav()
call head_var(2,0,"","")
call dvbbs_error()
else
call nav()
call head_var(1,boarddepth,"","")
call main()
if founderr then call dvbbs_error()
end if
call activeonline()
call footer()
sub main()
dim re
dim po,ii
dim reContent
dim strContent
dim PostBuyUser
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
po=0
ii=0
dim usermoney
set rs=conn.execute("select userWealth from [user] where userid="&userid)
usermoney=rs(0)
set rs=server.createobject("adodb.recordset")
sql="select body,PostBuyUser,username,PostUserID from "&request("PostTable")&" where Announceid="&Announceid
rs.open sql,conn,1,3
if rs.eof and rs.bof then
founderr=true
Errmsg=Errmsg+"<br>"+"<li>錯誤的帖子參數。"
exit sub
else
strContent=rs(0)
PostBuyUser=rs(1)
re.Pattern="(^.*)(\[usemoney=*([0-9]*)\])(.*)(\[\/usemoney\])(.*)"
po=re.Replace(strContent,"$3")
if IsNumeric(po) then
ii=int(po)
else
ii=0
end if
if membername=rs(2) then
response.write "<script>alert('呵呵,您要花錢購買自己發布的帖子嘛?');</script>"
elseif usermoney>ii then
if (not isnull(PostBuyUser)) and PostBuyUser<>"" then
if instr("|"&PostBuyUser&"|","|"&membername&"|")>0 then
response.write "<script>alert('呵呵,您已經購買過了呀?');</script>"
else
conn.execute("update [user] set userWealth=userWealth-"&ii&" where userid="&userid)
conn.execute("update [user] set userWealth=userWealth+"&ii&" where userid="&rs(3))
rs(1)=rs(1) & "|" & membername
rs.update
response.write "<script>alert('購買成功!');</script>"
end if
else
conn.execute("update [user] set userWealth=userWealth-"&ii&" where userid="&userid)
conn.execute("update [user] set userWealth=userWealth+"&ii&" where userid="&rs(3))
rs(1)=membername
rs.update
response.write "<script>alert('購買成功!');</script>"
end if
else
response.write "<script>alert('您都沒有錢呀?');</script>"
end if
end if
rs.close
set rs=nothing
response.redirect "dispbbs.asp?boardid="&request("boardid")&"&id="&rootid&"&replyID="&AnnounceID&"&skin=1"
end sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -