标题:求助, 如何做成 只可以选择最多选择5项投票!
只看楼主
黑居士
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-9-19
 问题点数:0 回复次数:0 
求助, 如何做成 只可以选择最多选择5项投票!
<%Dim Action,ID
BBS.CheckMake
If not BBS.FoundUser Then BBS.GoToErr(10)
ID=BBS.CheckNum(request.querystring("Id"))
Action=Lcase(Request.querystring("Action"))
If len(Action)>13 then BBS.GoToErr(1)
If Action="vote" Then
    SubmitVote()
Else
    SubmitBuyer()
End If
Set BBS =Nothing
Response.redirect(Request.ServerVariables("HTTP_REFERER"))

Sub SubmitVote()
    Dim Temp,Rs,i,VoteType,Vote,VoteNum,TempVote,MyOpt,OutTime,AllVoteNum
    IF ID=0 Then BBS.GoToErr(1)
    VoteType=BBS.checknum(request.querystring("type"))
    Set Rs=BBS.execute("select Vote,VoteNum,VoteType,OutTime From[TopicVote] where TopicID="&ID&"")
    IF Not Rs.Eof Then
        Vote=split(Rs("vote"),"|")
        VoteNum=split(Rs("voteNum"),"|")
        OutTime=Rs("OutTime")
        IF VoteType<>Int(Rs("VoteType")) Then BBS.GoToErr(1)
        TempVote=Vote
        if VoteType=1 then
            Temp=BBS.CheckNum(Request.form("opt"))
            MyOpt=Temp
            For i=1 to ubound(Vote)
                If i=Temp then VoteNum(i)=VoteNum(i)+1
                AllVoteNum=AllVoteNum&"|"&VoteNum(i)
            Next
        ElseIf VoteType=2 Then
            Temp=0
            TempVote=Vote
            For i=1 to ubound(Vote)
                TempVote(i)=BBS.Checknum(Request.form("opt"&i&""))
                Temp=TempVote(i)+Temp
                IF TempVote(i)=0 Then TempVote(i)=VoteNum(i)
                IF TempVote(i)=i Then
                 TempVote(i)=Votenum(i)+1
                 MyOpt=MyOpt&","&i
                End if
                AllVoteNum=AllVoteNum&"|"&TempVote(i)  
            Next
        Else
            BBS.GoToErr(1)
        End if
        If temp=0 Then BBS.alert"请选择投票!","back"
        IF Temp<>0 And BBS.execute("select User From [TopicVoteUser] where User='"&BBS.MyName&"' and TopicID="&ID&"").Eof Then
            If DateDiff("s",BBS.NowBbsTime,OutTime)>0 then
            BBS.execute("update [TopicVote] Set VoteNum='"&AllvoteNum&"' where TopicID="&ID&"")
            BBS.execute("update [Topic] Set LastTime='"&BBS.NowBbsTime&"' where TopicID="&ID&"")
            BBS.execute("update [bbs"&BBS.TB&"] Set LastTime='"&BBS.NowBbsTime&"' where TopicID="&ID&"")
            BBS.execute("Insert into [TopicVoteUser](TopicID,[User],VoteNum)VALUES("&ID&",'"&BBS.MyName&"','"&MyOpt&"')")
            End If
        End If
    End if
              
    Rs.Close
    Set Rs=nothing
End Sub
搜索更多相关主题的帖子: request 如何 
2011-09-19 15:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-350301-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.469738 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved