Jump to content


Photo

Help With Polls


  • Please log in to reply
2 replies to this topic

#1 Unholy Prayer

Unholy Prayer
  • Members
  • PipPipPip
  • Advanced Member
  • 166 posts

Posted 03 August 2006 - 10:10 AM

Ok, there are only two things wrong with the poll system I am currently using is that users can vote more than once. 

1. Users can vote more than once.  All they have to do is refresh the page.
2. Everytime I refresh the page, the POST DATA prompt comes up.

How do I fix these problems?  You can see my poll system at my newly launched website:
http://www.mtechdev.com/ 

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 03 August 2006 - 10:29 AM

the code snippit checking if they have voted needs to be on that page before the mysql query

Tell me the problem, I will try tell you the solution

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 10:34 AM

You could add some kind of session variable. After they vote then you can do something like this

<?php
session_start();
//your poll code
//if vote is sucessful 
$SESSION['voted'] = "true";
?>

Now you can place this at the top of your poll form
<?php
session_start();
if ($_SESSION['posted'] == "true") {
   echo "You may not vote twice";
   include("something.php");
   exit;
}
?>
 

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users