Hey. I just needed a little help with a voting system for articles I've put together in PHP. Essentially what happens is someone clicks the "Vote up" button which takes them to the "voteup.php" page.
This is the "voteup.php" page where it updates the database for that given article and increments the "votes" column by one. This works perfectly. But the problem is people can do this infinite times and give articles infinite votes.
I need it so that each IP address can only vote on each specific article once. Any ideas on how this could be done?
Voteup.php
<?php
include("connect.php");
$id2 = $_GET['id']; // Get the ID of the article that will be voted up
$con = mysql_connect("localhost","lconditn_admin","hello");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("lconditn_database", $con);
mysql_query("UPDATE base SET votes = votes+1 // Add one vote to the article
WHERE id2 = '$id2'");
mysql_close($con);
?>
Thanks a lot for any help with this.