I have written a script for a feature that will give diamonds to my players for voting, I am having some trouble with my cookie.
Heres my php script, there is an html on another website that acts as a form.

<?php
//Input correct values into this section
$dbhost = '********';
$dbuser = '*****';
$dbpass = '***************';
$dbname = '****';
$dbtable = 'redeem';
//---------------------------------------
$expire=time()+(3600*24);
$input = 'diamond 12';
$player = $_POST['Player'];
$ip=@$REMOTE_ADDR;
//-----This is the cookie vvv
setcookie("24Hourvote", $ip, $expire);

if(isset($_COOKIE['24Hourvote'])){
die ();
echo 'You already voted today! Come back later.';
} else {
//---- This is the connection
$conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ('Error: ' . mysql_error());
mysql_select_db($dbname);
$query = "INSERT INTO `".$dbname."`.`".$dbtable."` (`player`, `item`) VALUES ('".$player."', '".$input."')";
//-------------------------------------
// This is where the script actually does something.
mysql_query($query);
mysql_close($conn);
echo 'Type /redeem to get diamonds';
}
?>



Im trying to make it where if you have the cookie set on your computer, it will not let you vote, and it expires after 24 hours to let you vote once per day. But it doesnt seem to be working, I get no errors or anything but... it just doesnt work or add the cookie.


Also! It seems to work with any username, even if i just refresh the page it still acts as though it gave diamonds to someone...

I have my form on another website... does it need to be on the same website? if so how could i take my module and "embed" it to my site