?? savevote.asp
字號:
<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/char_board.asp" -->
<!-- #include file="inc/char_login.asp" -->
<!-- #include file="inc/chkinput.asp" -->
<!-- #include file="inc/ubbcode.asp" -->
<!--#include file="md5.asp"-->
<%
dim announceid
dim UserName
dim userPassword
dim useremail
dim Topic
dim body
dim dateTimeStr
dim ip
dim Expression
dim signflag
dim mailflag
dim boardstat
dim usercookies
dim votetype,vote,votenum
dim vote_1,votelen,votenumlen,j
dim votetimeout
dim rootid
dim ihaveupfile,upfileinfo,upfilelen
stats="發表投票"
if BoardID="" or not isInteger(BoardID) or BoardID=0 then
Errmsg=Errmsg+"<br>"+"<li>錯誤的版面參數!請確認您是從有效的連接進入。"
founderr=true
else
BoardID=clng(BoardID)
end if
IP=Request.ServerVariables("REMOTE_ADDR")
Expression=Checkstr(Request.Form("Expression"))
Topic=Checkstr(trim(request.Form("subject")))
Body=Checkstr(trim(request.Form("Content")))
UserName=Checkstr(trim(request.Form("username")))
Signflag=Checkstr(trim(request.Form("signflag")))
mailflag=Checkstr(trim(request.Form("Forum_Setting(2)")))
if memberword=trim(request.Form("passwd")) then
UserPassWord=Checkstr(trim(request.Form("passwd")))
else
UserPassWord=md5(Checkstr(trim(request.Form("passwd"))))
end if
if request.form("upfilerename")<>"" then
ihaveupfile=1
upfileinfo=replace(request.form("upfilerename"),"'","")
upfilelen=len(upfileinfo)
upfileinfo=left(upfileinfo,upfilelen-1)
else
ihaveupfile=0
end if
votetype=Checkstr(request.Form("votetype"))
vote=Checkstr(trim(replace(request.Form("vote"),"|","")))
rem -----檢查user輸入數據的合法性------
dim num1,rndnum,k
if signflag="yes" then
signflag=1
else
signflag=0
end if
if mailflag="yes" then
mailflag=1
else
mailflag=0
end if
if cint(Board_Setting(30))=1 then
if not (isnull(session("lastpost")) or boardmaster or master or superboardmaster) then
if DateDiff("s",session("lastpost"),Now())<cint(Board_Setting(31)) then
ErrMsg=ErrMsg+"<Br>"+"<li>本論壇限制發貼距離時間為"&Board_Setting(31)&"秒,請稍后再發。"
FoundErr=True
end if
end if
end if
if chkpost=false then
ErrMsg=ErrMsg+"<Br>"+"<li>您提交的數據不合法,請不要從外部提交發言。"
FoundErr=True
end if
if UserName="" or UserPassWord="" then
username=membername
UserPassWord=memberword
end if
if UserName="" then
ErrMsg=ErrMsg+"<Br>"+"<li>請輸入姓名(長度不能大于20)"
FoundErr=True
end if
if Topic="" then
FoundErr=True
ErrMsg=ErrMsg+"<Br>"+"<li>主題不應為空。"
elseif strLength(topic)>50 then
FoundErr=True
ErrMsg=ErrMsg+"<Br>"+"<li>主題長度不能超過50"
end if
if strLength(body)>Clng(Board_Setting(16)) then
ErrMsg=ErrMsg+"<Br>"+"<li>發言內容不得大于" & CSTR(Board_Setting(16)) & "bytes"
FoundErr=true
end if
if body="" then
ErrMsg=ErrMsg+"<Br>"+"<li>沒有填寫內容。"
FoundErr=true
end if
if vote="" then
ErrMsg=ErrMsg+"<Br>"+"<li>請輸入投票內容"
FoundErr=true
else
vote=split(vote,chr(13)&chr(10))
j=0
for i = 0 to ubound(vote)
if not (vote(i)="" or vote(i)=" ") then
vote_1=""&vote_1&""&vote(i)&"|"
j=j+1
end if
if i>cint(Board_Setting(32))-2 then exit for
next
for k = 1 to j
votenum=""&votenum&"0|"
next
votelen=len(vote_1)
votenumlen=len(votenum)
votenum=left(votenum,votenumlen-1)
vote=left(vote_1,votelen-1)
end if
if not isnumeric(request("votetimeout")) then
ErrMsg=ErrMsg+"<Br>"+"<li>錯誤的時間參數。"
FoundErr=true
else
if request("votetimeout")="0" then
votetimeout=dateadd("d",9999,Now())
else
votetimeout=dateadd("d",request("votetimeout"),Now())
end if
votetimeout=replace(replace(CSTR(votetimeout+Forum_Setting(0)/24),"上午",""),"下午","")
end if
session("lastpost")=Now()
if founderr then
call nav()
call head_var(2,0,"","")
call dvbbs_error()
else
call nav()
call head_var(1,BoardDepth,0,0)
call main()
if founderr then call dvbbs_error()
end if
call footer()
sub main()
if Cint(Board_Setting(43))=1 then
Errmsg=Errmsg+"<br>"+"<li>本論壇已經被管理員限制了不允許發貼。"
founderr=true
exit sub
end if
if Cint(GroupSetting(8))=0 then
Errmsg=Errmsg+"<br>"+"<li>您沒有在本論壇發表投票的權限,請<a href=login.asp>登陸</a>或者同管理員聯系。"
founderr=true
exit sub
end if
if cint(Board_Setting(2))=1 then
if not founduser then
Errmsg=Errmsg+"<br>"+"<li>本論壇為認證論壇,請<a href=login.asp>登陸</a>并確認您的用戶名已經得到管理員的認證后進入。"
founderr=true
exit sub
else
if chkboardlogin(boardid,membername)=false then
Errmsg=Errmsg+"<br>"+"<li>本論壇為認證論壇,請確認您的用戶名已經得到管理員的認證后進入。"
founderr=true
exit sub
end if
end if
end if
usercookies=request.Cookies("aspsky")("usercookies")
if isnull(usercookies) or usercookies="" then usercookies=3
if chkuserlogin(username,userpassword,usercookies,2)=false then
errmsg=errmsg+"<br>"+"<li>您的用戶名并不存在,或者您的密碼錯誤,或者您的帳號已被管理員鎖定。"
founderr=true
exit sub
end if
if cint(Board_Setting(1))=1 then
if Cint(GroupSetting(37))=0 then
Errmsg=ErrMsg+"<Br>"+"<li>您沒有權限進入隱含論壇!"
founderr=true
exit sub
end if
end if
dim locktopic
if master or superboardmaster or boardmaster then
isaudit=0
locktopic=0
elseif isaudit=1 and not (master or superboardmaster or boardmaster) then
isaudit=1
locktopic=3
else
isaudit=0
locktopic=0
end if
dim LastPost,LastPost_1,uploadpic_n,Forumupload,u
dim LastPostTimes,voteid
DateTimeStr=replace(replace(CSTR(NOW()+Forum_Setting(0)/24),"上午",""),"下午","")
'插入投票記錄
conn.execute("insert into vote (vote,votenum,votetype,timeout) values ('"&vote&"','"&votenum&"',"&votetype&",'"&votetimeout&"')")
set rs=conn.execute("select top 1 voteid from vote order by voteid desc")
voteid=rs(0)
'插入主題表
sql="insert into topic (Title,Boardid,PostUsername,PostUserid,DateAndTime,Expression,LastPost,LastPostTime,isvote,PollID,voteTotal,PostTable,locktopic) values ('"&topic&"',"&boardid&",'"&username&"',"&userid&",'"&DateTimeStr&"','"&Expression&"','$$"&DateTimeStr&"$$$$','"&DateTimeStr&"',1,"&voteid&",0,'"&NowUseBbs&"',"&locktopic&")"
conn.execute(sql)
set rs=conn.execute("select top 1 topicid from topic order by topicid desc")
rootid=rs(0)
Forum_upload="gif,jpg,jpeg,bmp,zip,rar,html,swf,mid,midi,flash,rm,ra,asf,avi,wmv,exe,xls,dos,ftp,mp3,m3u,txt,mdb,dll,IMG"
Forumupload=split(Forum_upload,",")
for u=0 to ubound(Forumupload)
if instr(body,"[upload="&Forumupload(u)&"]") or instr(body,"."&Forumupload(u)&"") or instr(body,"["&Forumupload(u)&"]") then
uploadpic_n=Forumupload(u)
exit for
end if
next
if instr(body,"viewfile.asp?ID=") then uploadpic_n="down"
'插入回復表
Sql="insert into "&NowUseBbs&"(Boardid,ParentID,username,topic,body,DateAndTime,length,rootid,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID,isupload,isaudit) values ("&boardid&",0,'"&username&"','"&topic&"','"&body&"','"&DateTimeStr&"','"&strlength(body)&"',"&rootid&",1,0,'"&ip&"','"&Expression&"',"&locktopic&","&signflag&","&mailflag&",0,"&userid&","&ihaveupfile&","&isaudit&")"
conn.execute(sql)
set rs=conn.execute("select top 1 Announceid from "&NowUseBbs&" order by Announceid desc")
Announceid=rs(0)
if ihaveupfile=1 then conn.execute("update dv_upfile set F_AnnounceID='"&rootid&"|"&AnnounceID&"' where F_ID in ("&upfileinfo&")")
LastPost=replace(username,"$","") & "$" & Announceid & "$" & DateTimeStr & "$" & replace(cutStr(body,20),"$","") & "$" & uploadpic_n & "$" & UserID & "$" & rootid & "$" & BoardID
LastPost=reubbcode(replace(LastPost,"'",""))
conn.execute("update topic set LastPost='"&LastPost&"' where topicid="&rootid)
LastPost_1=replace(username,"$","") & "$" & Announceid & "$" & DateTimeStr & "$" & replace(cutStr(Topic,20),"$","") & "$" & uploadpic_n & "$" & UserID & "$" & rootid & "$" & BoardID
LastPost_1=reubbcode(replace(LastPost_1,"'",""))
if isaudit=0 then
Dim UpdateBoardID
UpdateBoardID=BoardParentStr & "," & BoardID
if datediff("d",LastPostTime,Now())=0 then
sql="update board set lastbbsnum=lastbbsnum+1,lasttopicnum=lasttopicnum+1,todaynum=todaynum+1,LastPost='"&LastPost_1&"' where boardid in ("&UpdateBoardID&")"
else
sql="update board set lastbbsnum=lastbbsnum+1,lasttopicnum=lasttopicnum+1,todaynum=1,LastPost='"&LastPost_1&"' where boardid in ("&UpdateBoardID&")"
end if
conn.execute(sql)
Dim updateinfo
set rs=conn.execute("select LastPost,TodayNum,MaxPostNum from config where active=1")
LastPostTimes=split(rs(0),"$")
LastPostTime=LastPostTimes(2)
if not isdate(LastPostTime) then LastPostTime=Now()
if datediff("d",LastPostTime,Now())=0 then
if rs(1)+1>rs(2) then updateinfo=",MaxPostNum=todaynum+1"
sql="update config set topicnum=topicnum+1,bbsnum=bbsnum+1,todayNum=todayNum+1,LastPost='"&LastPost&"' "&updateinfo&" where active=1"
else
sql="update config set topicnum=topicnum+1,bbsnum=bbsnum+1,yesterdaynum="&rs(1)&",todayNum=1,LastPost='"&LastPost&"' where active=1"
end if
conn.execute(sql)
end if
dim PostRetrunName,PostRetrun
select case Board_Setting(17)
case 1
response.write "<meta http-equiv=refresh content=""3;URL=index.asp"">"
PostRetrunName="首頁"
case 2
response.write "<meta http-equiv=refresh content=""3;URL=list.asp?boardid="&boardid&""">"
PostRetrunName="您所發布的論壇"
case 3
if isaudit=1 then
response.write "<meta http-equiv=refresh content=""3;URL=list.asp?boardid="&boardid&""">"
PostRetrunName="您發布的帖子必須經管理員審核后方可見"
else
response.write "<meta http-equiv=refresh content=""3;URL=dispbbs.asp?boardid="&boardid&"&id="&rootid&""">"
PostRetrunName="您所發表的帖子"
end if
end select
set rs=nothing
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<tr align=center><th width="100%">狀態:<%=stats%></td>
</tr><tr><td width="100%" class=tablebody1>
本頁面將在3秒后自動返回<%=PostRetrunName%>,<b>您可以選擇以下操作:</b><br><ul>
<li><a href="index.asp">返回首頁</a></li>
<li><a href="list.asp?boardid=<%=boardid%>"><%=boardtype%></a></li>
<li><%if isaudit=1 then%><%=PostRetrunName%><%else%><a href="dispbbs.asp?boardid=<%=boardid%>&id=<%=rootid%>&star=<%=request("star")%>#<%=announceid%>"><%=PostRetrunName%></a><%end if%></li>
</ul></td></tr></table>
<%
end sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -