Hello. I'm wondering if someone could help me. I have a simple like/dislike voting voting system. Everything works fine but a user is able to click both up and down freely without checking if they have voted.
So what I'm going for is 'Php sessions' because I dont want to clutter a table in mysql with ips and its superficial voting.
I'm using ajax to avoid a refresh which calls on two scripts to add the +1 count to the columns in my table (up/down)
up.php
<?php
include("dbcon.php");
if($_POST['id'])
{
$id=$_POST['id'];
$id = mysql_escape_String($id);
$sql = "update comments set up=up+1 where id='$id'";
mysql_query( $sql);
$result=mysql_query("select up from comments where id='$id'");
$row=mysql_fetch_array($result);
$up_value=$row['up'];
echo "<img src='images/up.png' ALIGN='top' height='14px' width='14px'/> $up_value";
}
?>
The down.php is the same mostly of course.
How do i add sessions to this so i can vote up only once for each comment on a page?
I was able to do ips in a database fine but this is above me. any help please and thanks.