I have a PHP code in which people can submit unlimited entries for giveaways,i want you to edit that code so people can submit only one entry for there IP for each giveaway.I mean one entry per IP per giveaway.
Here is processEntry.php code:
Code: Select all
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="coinbudy"; // Database name
$tbl_name="entries"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$giveaway_id=$_POST['giveaway_id'];
$email=$_POST['email'];
$payment=$_POST['payment'];
$proof=$_POST['proof'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(giveaway_id ,email, payment, proof)VALUES('$giveaway_id', '$email', '$payment', '$proof')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
$msg="Successfully Updated!!";
echo "<script type='text/javascript'>alert('$msg');</script>";
header('Location:admin.php');
}
else
{
$errormsg="Something went wrong, Try again";
echo "<script type='text/javascript'>alert('$errormsg');</script>";
header('Location:admin.php');
}
?>
<?php
// close connection
mysql_close();
?>
<?php