am currently running an open voting system with no login form. I wanted to restrict double voting using user IP Addresses, how can I record user addresses direct to my database and use them to restrict double voting?

closed as off-topic by mustaccio, MDCCL, hot2use, Philᵀᴹ, Marian May 17 at 10:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Keep in mind that some ISPs, such as AOL, do not tie an IP to a specific user -- one user could show up at a different IP and, vice versa, two users could come from the same IP. – Rick James May 16 at 23:57

The webserver exposes it as a variable to PHP like this SO answer. PHP can then use that to insert into the database.

Given the scale of NAT usage as one of the factors where legitimate two votes from same IP could occur, I suggest setting a cookie on the browser as an anti-duplicate mechanism.

  • Thank you for your answer, may you help me with the cookies code.. I would like the block the already voted voter for 7days after casting vote – MagoTech May 15 at 23:44
  • I have two pages, home.php, and submit_ballot.php page see github.com/magotech/Open-Online-Voting-System – MagoTech May 15 at 23:48
  • stackoverflow.com is a forum for asking application programming like questions (which is where this question should of been asked), but I suggest trying yourself before asking (its a help site only). Look up how to do SQL joins, your code needs it. – danblack May 15 at 23:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.