📄 forum_postvote.asp
字号:
<!--#include file=INC/skin.asp-->
<%
dim const_txl_HomeUrl,errstr,i,BoardID,BoardName,boardexist,returnmainstr,url
Url=Request.ServerVariables("HTTP_REFERER")
errstr=""
boardexist=false
const_txl_HomeUrl=""
call OpenDatabase
call txl_SiteHead(const_txlname&"-影音论坛")
returnmainstr=main
call online
call CloseDatabase
call web_end
Response.write returnmainstr
Function Main()
If const_bbs_login_limit=1 Then '论坛登录查看限制
If session("username")="" Then
errstr="<li>当前Wap影音状态已经设置为<font color=red>影音论坛只有登录之后才能看到</font>!</li>"
errstr=errstr&"<li>你现在还没有登录或者会话超时,点<a href='user_login.asp'>这里登录</a>!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("访问影音论坛出错!",errstr,779)
Exit Function
End If
ElseIf const_bbs_login_limit=2 Then
If session("username")="" Then
errstr="<li>当前Wap影音状态已经设置为<font color=red>影音论坛只有影音成员和嘉宾有查看权限</font>!</li>"
errstr=errstr&"<li>你现在还没有登录或者会话超时,点<a href='user_login.asp'>这里登录</a>!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("访问影音论坛出错!",errstr,779)
Exit Function
End If
If not (session("usertype")=3 or session("usertype")=4) Then
errstr="<li>当前Wap影音状态已经设置为<font color=red>影音论坛只有影音成员和嘉宾有查看权限</font>!</li>"
errstr=errstr&"<li>你目前的身份没有该权限!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("访问影音论坛出错!",errstr,779)
Exit Function
End If
End If
if outsitesubmit then
printerror "访问影音论坛出错!","<li>请不要外部提交数据!</li>",779
exit Function
end if
Dim ID,list,tmprs
list=""
ID=Request("id")
If ID="" or (Not Isnumeric(ID)) Then
printerror "投票出错","<li>试图传递非法的参数 !</li>",779
Exit Function
End If
if Request("menu")="look" then
set tmprs=conn.execute("select top 10 pollusername from postvote where pollvoteid="&ID)
while Not tmprs.Eof
list=list&tmprs(0)&"\n"
tmprs.MoveNext
Wend
tmprs.Close
Set tmprs=Nothing
if list="" then
Main="<script>alert('目前暂时没有记录投票的用户名单!');window.location=href='"&Url&"';</script>"
Exit Function
else
Main="<script>alert('参与投票的用户名单:\n"&list&"');window.location=href='"&Url&"';</script>"
Exit Function
end if
end if
If session("username")="" then
printerror "投票出错","<li>您还没有登录,请先<a href='"&const_txl_HomeUrl&"user_login.asp'>登录</a>再进行相关操作!</li>",779
Exit Function
End if
If Request("postvote")="" then
Main="<script>alert('请选择,你要投票的项目!');window.location=href='"&Url&"';</script>"
Exit Function
End if
set tmprs=conn.execute("select ID from postvote where pollvoteid="&ID&" and pollusername='"&session("username")&"'")
If Not tmprs.Eof Then
Main="<script>alert('你已经投过票了,无需重复投票!');window.location=href='"&Url&"';</script>"
Exit Function
End If
Dim Rs,ho,pollresult,allpollresult,i,sql,wid
sql="select * from Announce where id="&id&""
Set Rs=Server.CreateObject("Adodb.Recordset")
rs.Open sql,Conn,1,3
for each ho in request.form("postvote")
pollresult=split(rs("pollresult"),"|")
for i = 0 to ubound(pollresult)
if not Trim(pollresult(i))="" then
if cint(ho)=i then
pollresult(i)=pollresult(i)+1
end if
allpollresult=""&allpollresult&""&pollresult(i)&"|"
end if
next
rs("pollresult")=allpollresult
rs("lastuser")=session("username")
rs("lasttime")=now()
rs.update
allpollresult=""
next
rs.close
sql="select top 1 * from postvote order by id desc"
rs.open sql,conn,1,3
if rs.eof then
wid=1
else
wid=rs("ID")+1
end if
rs.addnew()
rs("id")=wid
rs("pollusername")=session("username")
rs("pollvoteid")=id
rs.update
rs.close
set rs=Nothing
Main="<script>alert('投票成功!!');window.location=href='"&Url&"';</script>"
Exit Function
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -