% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Forums(TM) '** http://www.webwizforums.com '** '** Copyright (C)2001-2008 Web Wiz(TM). All Rights Reserved. '** '** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM 'WEB WIZ'. '** '** IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN 'WEB WIZ' IS UNWILLING TO LICENSE '** THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE '** AND DERIVATIVE WORKS IMMEDIATELY. '** '** If you have not received a copy of the license with this work then a copy of the latest '** license contract can be found at:- '** '** http://www.webwizguide.com/license '** '** For more information about this software and for licensing information please contact '** 'Web Wiz' at the address and website below:- '** '** Web Wiz, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, BH15 4JD, England '** http://www.webwizguide.com '** '** Removal or modification of this copyright notice will violate the license contract. '** '**************************************************************************************** '*************************** SOFTWARE AND CODE MODIFICATIONS **************************** '** '** MODIFICATION OF THE FREE EDITIONS OF THIS SOFTWARE IS A VIOLATION OF THE LICENSE '** AGREEMENT AND IS STRICTLY PROHIBITED '** '** If you wish to modify any part of this software a license must be purchased '** '**************************************************************************************** 'Declare variables Dim strPollQuestion 'Holds the poll question Dim intPollChoiceNumber 'Holds the poll choice number Dim strPollChoice 'Holds the poll choice Dim lngPollChoiceVotes 'Holds the choice number of votes Dim lngTotalPollVotes 'Holds the total number of votes Dim dblPollVotePercentage 'Holds the vote percentage for the vote choice Dim blnAlreadyVoted 'Set to true if the user has already voted Dim blnMultipleVotes 'set to true if multiple votes are allowed Dim sarryPoll 'Array to hold the poll recordset Dim intPollCurrentRecord 'Hold the current postion in array 'Initlise variables blnAlreadyVoted = False intPollCurrentRecord = 0 'Get the poll from the database 'Initalise the strSQL variable with an SQL statement to query the database get the thread details strSQL = "SELECT " & strDbTable & "Poll.Poll_question, " & strDbTable & "Poll.Multiple_votes, " & strDbTable & "Poll.Reply, " & strDbTable & "PollChoice.Choice_ID, " & strDbTable & "PollChoice.Choice, " & strDbTable & "PollChoice.Votes " & _ "FROM " & strDbTable & "Poll" & strDBNoLock & ", " & strDbTable & "PollChoice" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Poll.Poll_ID=" & strDbTable & "PollChoice.Poll_ID " & _ "AND " & strDbTable & "Poll.Poll_ID=" & lngPollID & ";" 'Query the database rsCommon.Open strSQL, adoCon 'If no record release rs If rsCommon.EOF Then 'Close recordsets rsCommon.Close 'If there is a poll then display it Else 'Read in the row from the db using getrows for better performance sarryPoll = rsCommon.GetRows() 'Close recordsets rsCommon.Close 'Initilise total votes lngTotalPollVotes = 0 'Read in the poll question strPollQuestion = sarryPoll(0,0) 'See if multiple votes are allowed blnMultipleVotes = CBool(sarryPoll(1,0)) 'See if this is a poll only blnPollNoReply = CBool(sarryPoll(2,0)) 'Loop through and get the total number of votes Do While intPollCurrentRecord < (UBound(sarryPoll,2) + 1) 'Get the total number of votes lngTotalPollVotes = lngTotalPollVotes + CLng(sarryPoll(5,intPollCurrentRecord)) 'Move to the next array position intPollCurrentRecord = intPollCurrentRecord + 1 Loop 'Reset array position intPollCurrentRecord = 0 'If multiple votes are not allowed see if the user has voted before If blnMultipleVotes = False Then 'Check the user has not already voted by reading in a cookie from there system 'Read in the Poll ID number of the last poll the user has voted in If CInt(getCookie("pID", "PID" & lngPollID)) = lngPollID OR CInt(getSessionItem("PID" & lngPollID)) = lngPollID Then blnAlreadyVoted = True End If %>