📄 config_poll.asp
字号:
<%
dim strPollPost,ispollpost,strPollTotals,txtPollMessage,strMessage,isvote,strPollNumlen,strPollNum,strPollDetail,strPollDetailLen,strPollLen,strSql,j,k
dim istopicvote,vrs,TxtPollMsg,TextAreaAttrib,strVoteHide,strVoteType,strPollMessageArr,intPollMessages
dim strTopicID,strPollMessage,strPollUser,strPollType,strPollHide,strPollNumArr,intPollPosts,strPollMessages,strInsistFONTColor,strPrivateForums,strCatStatus,strForumStatus
dim strRqForumID,strRqTopicID,strPollUserArr,strCheckUser,mLev,strForumModerator,strColspan,strMessageArr,intMessages,iCheck,intPoll,strPercent,intPercent,strPollSeq
dim strRqPollType,strRqPollID,strRqCatID,strRqMyChoice,strPollChoiceArr,strPollDetailArr,strPollDetailNew,strPollNum_New,P,Q,rsPollTopic,intPollusers
dim votetimeout
strPollPost =trim(Request.QueryString("poll"))
ispollpost =trim(Request.form("poll"))
strPollTotals=web_var(web_num,24)
function FormatPoll(fTopicID)
If fTopicID = 0 And "" & fTopicID & "" = "" Then
Exit function
End If
strSql = "SELECT V_ID, TOPIC_ID, V_MESSAGE, V_NUM, V_USER, V_DETAIL, V_TYPE, V_HIDE,V_TIMEOUT FROM bbs_vote"
strSql = strSql & " WHERE TOPIC_ID = " & fTopicID
strSql = strSql & " ORDER BY V_ID DESC"
set vrs = Conn.Execute (strSql)
If vrs.BOF or vrs.EOF Then
Exit function
Else
strTopicID = vrs("TOPIC_ID")
strPollMessage = vrs("V_MESSAGE")
strPollNum = vrs("V_NUM")
strPollUser = vrs("V_USER")
strPollDetail = vrs("V_DETAIL")
strPollType = vrs("V_TYPE")
strPollHide = vrs("V_HIDE")
'### 计算投票项目个数 intPollMessages ###
strPollMessageArr = Split(strPollMessage, "|")
intPollMessages = UBound(strPollMessageArr)
'### 计算总投票次数 intPollPosts ###
strPollNumArr = Split(strPollNum, ",")
intPollPosts = 0
For i = 0 To UBound(strPollNumArr)
intPollPosts = intPollPosts + cInt(strPollNumArr(i))
Next
strPollMessages = strPollMessages & "<BR><hr noshade size=1><TABLE cellpadding=1 cellspacing=0 border=0 width=* >" & vbCrLf
strPollMessages = strPollMessages & "<FORM action=Post_Poll.asp?forum_id="& forumid & " method=post><INPUT type=hidden name=Action value=poll><INPUT type=hidden name=VOTE_ID value=" & vrs("V_ID") & "><INPUT type=hidden name=Vote_Type value=" & strPollType & "><INPUT type=hidden name=FORUM_ID value=" & forumid & "><INPUT type=hidden name=TOPIC_ID value=" & strTopicID & ">" & vbCrLf
strPollMessages = strPollMessages & "<TR><TD nowrap><TABLE width=100% cellpadding=4 cellspacing=2><TR><TD nowrap>"
if GetPollUsers(strPollUser)="yes" or datediff("d",vrs("V_timeout"),Now())>0 then
strPollMessages = strPollMessages & "</TD></TR>" & vbCrLf & "<TR><TD nowrap align=center><P>您已经投过票,不能再进行投票;或者已经过了投票期限。</TD></TR></TABLE></TD></TR></FORM></TABLE>" & vbCrLf
else
For i = 0 To intPollMessages
if vrs("v_type")=0 then
strPollMessages=strPollMessages & "<input type=radio name=mychoice name=myChoice id=myChoice_" & i & " value="""&i&""">"
else
strPollMessages=strPollMessages & "<input type=checkbox name=myChoice id=myChoice_" & i & " value="""&i&""">"
end if
strPollMessages = strPollMessages&" <LABEL for=myChoice_" & i & " style='CURSOR: HAND;'> " & strPollMessageArr(i) & "</LABEL><BR>"
Next
strPollMessages = strPollMessages & "</TD></TR>" & vbCrLf & "<TR><TD nowrap align=center><HR width=85% size=1><P><INPUT type=submit name=results value=参加投票 ></TD></TR></TABLE></TD></TR></FORM></TABLE>" & vbCrLf
end if
If intPollPosts = 0 Then
strPollMessages = strPollMessages & "<P><FONT color=" & strInsistFONTColor & ">目前暂时没有人投票!</FONT></P>"
Else
strPollMessages = strPollMessages & GetPollMessages(strPollNum, strPollMessage, strPollUser, strPollDetail, strPollType, strPollHide)
End If
End If
vrs.close
set vrs = nothing
FormatPoll = "<P>" & strPollMessages & "</P><BR>"
end function
'### 产生投票项目列表 ###
function GetPollMessages(fNum, fMessage, fUser, fDetail, fType, fHide)
GetPollMessages = ""
If ""&fMessage&"" = "" Or InStr(fMessage, "|") = 0 Or ""&fDetail&"" = "" Or _
""&fUser&"" = "" Or ""&fType&"" = "" Or ""&fHide&"" = "" Or InStr(fNum, ",") = 0 Then
Exit function
End If
strCheckUser = GetPollUsers(fUser)
If strCheckUser = "no" and cInt(fHide) = 1 Then
If format_user_power(login_username,login_mode,forumpower)<>"yes" Then
GetPollMessages = "<P><FONT color=red>对不起,你必需先投票才可看结果!</FONT></P>"
Exit function
End If
End If
If mLev = 4 or mLev = 10 or strForumModerator = 1 Then
strColspan = "3"
Else
strColspan = "2"
End If
'### 计算总投票次数 intPollPosts ###
strPollNumArr = Split(fNum, ",")
intPollPosts = 0
For i = 0 To UBound(strPollNumArr)
intPollPosts = intPollPosts + cInt(strPollNumArr(i))
Next
'### 计算投票人数 intPollusers ###
strPolluserArr = Split(fuser, ",")
intPollusers = 0
For i = 0 To UBound(strPolluserArr)
intPollusers = intPollusers + 1
Next
'### 计算投票项目个数 intPollessages ###
strMessageArr = Split(fMessage, "|")
intMessages = UBound(strMessageArr)
strMessage = strMessage & "<TABLE width=99% id=Poll_Table border=0 cellspacing=0 cellpadding=2 style='border-collapse: collapse'><TR><TD colspan=" & strColspan & "><HR width=100% size=1></TD></TR><TR><TD colspan=" & strColspan & ">"
strMessage = strMessage & "<FONT color=red >"
If intPollPosts = 0 Then
strMessage = strMessage & "没有人参加此投票,选项列表如下:"
Else
strMessage = strMessage & "目前共有 <FONT color=red><B>" & intPollusers & "</B></FONT> 人参加投票(共"&intpollposts&"票),结果如下:"
End If
strMessage = strMessage & "<HR width=100% size=1></FONT></TD></TR>"
iCheck = 0
For i = 0 To intMessages
If (mLev = 4 or mLev = 10 or strForumModerator = 1) and iCheck = 0 Then
strMessage = strMessage & "<script>Poll_Table.width='107%';</script>"
iCheck = 1
End If
strMessage = strMessage & "<TR><TD NoWarp>"
strMessage = strMessage & strMessageArr(i)
strMessage = strMessage & "</TD><TD NoWarp>"
If i > 10 Then
strMessage = strMessage & FormatPollResult(strPollNumArr(i), intPollPosts, cInt(Mid(cStr(i), 2, 1)) - 1)
Else
strMessage = strMessage & FormatPollResult(strPollNumArr(i), intPollPosts, i)
End If
strMessage = strMessage & "</TD>"
If format_user_power(login_username,login_mode,forumpower)="yes" Then
strMessage = strMessage & "<TD NoWarp>" & getPollList(fDetail, i) & "</TD>"
End If
strMessage = strMessage & "</TR>" & vbCrLf
Next
strMessage = strMessage & "<TR><TD colspan=" & strColspan & "><HR width=100% size=1></TD></TR></TABLE>" & vbCrLf
If strCheckUser = "yes" Then
strMessage = strMessage & "<FONT color=blue>谢谢,你已经投过票了!</FONT>"
End If
GetPollMessages = strMessage
end function
'### 分析出每个投票项目的已投票会员 ###
function getPollList(fString, fSeq)
dim strPollNumTempArr,strPollDetailList,strPollDetailListArr,strPollDetailListArrs
getPollList = "<FONT color=blue>[没有人投票]</FONT>"
If ""&fString&"" = "" OR InStr(fString, ",") = 0 or ""&fSeq&"" = "" Then
Exit function
End If
strPollNumTempArr = Split(fString, ",")
If fSeq > UBound(strPollNumTempArr) Then
Exit function
End If
strPollDetailList = strPollNumTempArr(fSeq)
If strPollDetailList = "{}" Then
Exit function
End If
'## strPollDetailList = Mid(strPollDetailList, 2, Len(strPollDetailList)-2)
strPollDetailList = Replace(Replace(strPollDetailList, "{", ""), "}", "")
getPollList = "<SELECT><OPTION>投票人名单 </OPTION><OPTION>----------</OPTION>"
If InStr(strPollDetailList, "|") = 0 Then
If ""&strPollDetailList&"" <> "" Then
getPollList = getPollList & "<OPTION>" & strPollDetailList & "</OPTION>"
End If
Else
strPollDetailListArr = Split(strPollDetailList, "|")
strPollDetailListArrs = UBound(strPollDetailListArr)
For j = 0 To strPollDetailListArrs
getPollList = getPollList & "<OPTION>" & strPollDetailListArr(j) & "</OPTION>"
Next
End If
getPollList = getPollList & "</SELECT>"
end function
'### fTotal 总票数
'### fNum 票数
'### fSeq 序号
function FormatPollResult(fNum, fTotal, fSeq)
FormatPollResult = ""
If ""&fNum&"" = "" and ""&fSeq&"" = "" and ""&fTotal&"" = "" Then
Exit function
End If
intPoll = FormatNumber(150*(fNum/fTotal),0)
strPercent = (fNum/fTotal)
If strPercent <> 0 Then
If strPercent = 1 Then
intPercent = FormatPercent(strPercent, 0)
Else
intPercent = FormatPercent(strPercent, 1)
End If
Else
intPercent = strPercent & "%"
End If
strPollSeq = fSeq + 1
FormatPollResult = "<IMG src=images/forum/bar" & strPollSeq & ".gIf width=""" & intPoll & """ height=10> <B>" & fNum & "</B> 票数 " & intPercent
end function
'-----良友添加------------------
function getTopicPollMsg(fString)
getTopicPollMsg = ""
if ""&fString&"" = "" then
exit function
end if
strPollMessageArr = Split(fString, "|")
intPollMessages = UBound(strPollMessageArr)
For i = 0 To intPollMessages
getTopicPollMsg = getTopicPollMsg & strPollMessageArr(i) & CHR(10)
Next
end function
'### 检查当前会员是否已投票 ###
function GetPollUsers(fString)
GetPollUsers = "no"
If ""&fString&"" = "" Then
Exit function
End If
If InStr(fString, ",") Then
strPollUserArr = Split(fString, ",")
For i = 0 To UBound(strPollUserArr)
If strPollUserArr(i) = login_username Then
GetPollUsers = "yes"
Exit function
End If
Next
Else
If fString = login_username Then
GetPollUsers = "yes"
End If
End If
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -