Jump to content


PHP Voting script (really need help here)

  • Please log in to reply
1 reply to this topic

#1 pinkhooch

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 30 July 2006 - 04:48 PM

Hi guys, I'm really a newbie to php, hope you guys can help me over here. I'm having problem with my voting scripts that i got it from 3rd party. The voting system currently only allow the voters to vote once as their IP address is being saved in the database and the voter will not be able to vote again.
I will like to modify the script to allow the voters from the same ip to vote once per 24 hours. I search a few tutorial helps which states that setting the cookie will allow same ip to vote once per day.But really newbie and dont understand how it works... Please help me thanks!  :D

include "connect.php";
$ipchecks="SELECT*from P_ip where IP='$s'";

     print "You have already voted in this poll";
        $ipinsert="Insert into P_ip(IP) VALUES('$s')";
      	$vote = "UPDATE P_choices SET votes=votes+1 
		WHERE ID = '$ID'";
        print "Thanks for voting, <A href='poll.php'>Back to poll</a>";


#2 hackerkts

  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 31 July 2006 - 03:07 PM

Just a little rough idea I could think of, create another row for last voted date.
Then before user make a vote, check the current date and compare it to the database date.


To be a coder, you must learn how to think and not to give up so easily.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users