pinkhooch Posted July 30, 2006 Share Posted July 30, 2006 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[code]<?phpinclude "connect.php";$s=$_SERVER["REMOTE_ADDR"];$ipchecks="SELECT*from P_ip where IP='$s'";$ipchecks2=mysql_query($ipchecks);while($ipchecks3=mysql_fetch_array($ipchecks2)) { $isip=$ipchecks3[IP]; }if($isip) { print "You have already voted in this poll"; } else { $ID=$_POST['answer']; $ipinsert="Insert into P_ip(IP) VALUES('$s')"; mysql_query($ipinsert); $vote = "UPDATE P_choices SET votes=votes+1 WHERE ID = '$ID'"; mysql_query($vote); print "Thanks for voting, <A href='poll.php'>Back to poll</a>"; } ?>[/code] Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 31, 2006 Share Posted July 31, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.