time() ? 1 : 0; $qvoted = "SELECT * FROM TU_Votes WHERE "; $qvoted.= "VoteID = " . $row['ID'] . " AND "; $qvoted.= "UserID = " . uid_from_sid($_COOKIE["AURSID"]); $hasvoted = mysql_num_rows(db_query($qvoted, $dbh)); # Can this person vote? # $canvote = 1; // we assume they can $errorvote = ""; // error message to give if ($isrunning == 0) { $canvote = 0; $errorvote = "Voting is closed for this proposal."; } else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) { $canvote = 0; $errorvote = "You cannot vote in an proposal regarding you."; } else if ($hasvoted != 0) { $canvote = 0; $errorvote = "You've already voted in this proposal."; } # have to put this here so results are correct immediately after voting if ($canvote == 1) { if (isset($_POST['doVote'])) { if (isset($_POST['voteYes'])) { $myvote = "Yes"; } else if (isset($_POST['voteNo'])) { $myvote = "No"; } else if (isset($_POST['voteAbstain'])) { $myvote = "Abstain"; } $qvote = "UPDATE TU_VoteInfo SET " . $myvote . " = " . ($row[$myvote] + 1) . " WHERE ID = " . $row['ID']; db_query($qvote, $dbh); $qvote = "INSERT INTO TU_Votes (VoteID, UserID) VALUES (" . $row['ID'] . ", " . uid_from_sid($_COOKIE["AURSID"]) . ")"; db_query($qvote, $dbh); # Can't vote anymore # $canvote = 0; $errorvote = "You've already voted for this proposal."; # Update if they voted $hasvoted = mysql_num_rows(db_query($qvoted, $dbh)); $results = db_query($q, $dbh); $row = mysql_fetch_assoc($results); } } # I think I understand why MVC is good for this stuff.. echo "
because it still maintains word wrapping print str_replace("\n", "
\n", $row['Agenda']); print "
\n"; print "
\n"; print "\n"; print " \n"; print "\n"; print "
\n"; echo "\n"; print " \n"; print " \n"; print "
\n"; print "\n"; print " \n"; $c = "data1"; print ""; print "Yes"; print " \n"; print ""; print "No"; print " \n"; print ""; print "Abstain"; print " \n"; print ""; print "Total"; print " \n"; print ""; print "Voted?"; print " \n"; print "\n"; print " \n"; print ""; print $row['Yes']; print " \n"; print ""; print $row['No']; print " \n"; print ""; print $row['Abstain']; print " \n"; print ""; print ($row['Yes'] + $row['No'] + $row['Abstain']); print " \n"; print ""; if ($hasvoted == 0) { print "No"; } else { print "Yes"; } print " \n"; print "
\n"; print " $application\n"; print " | \n"; print "||||||||||||||||
\n";
print "
|
\n"; if ($off != 0) { $back = (($off - $limit) <= 0) ? 0 : $off - $limit; print "Back"; } print " | \n"; print "\n"; if (($off + $limit) < mysql_num_rows($nextresult)) { $forw = $off + $limit; print "Next"; } print " | \n"; print "