Hi there,
I'm currently using a contact form to allow people to submit votes for contestants in our talent contest, however, despite stating they are only allowed one vote per day, they are still submitted several hundred each! It at one point had my inbox clogged up with about 12'000 emails..
Is it possible to edit the following contact form to disallow a vote from an ip if it has already voted that day?
Here is the contact form page
<? include "pageheader.php" ?>
<?
$db=mysql_connect("********","********","**********");
mysql_select_db("**********",$db);
?>
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
<? $starname = $_GET['starname'] ?>
<? $starname=$_POST['starname']; ?>
<BR><span class="style1">Vote For <?php print "$starname"; ?></span>
<form method="POST" action="bsvotesend2.php">
<input type="hidden" name="vote" value="<?php print "$starname"; ?>" size="19"><br>
<br>
Your Name?<BR>
<input type="text" name="name" size="19"><br>
<br>
Your Email?<BR>
<input type="text" name="email" size="19"><br>
<br>
Your Telephone?<BR>
<input type="text" name="telephone" size="19"><br>
<br>
<input type="hidden" name="ip" value="<?
echo "$REMOTE_ADDR";
?>
<?php echo $REMOTE_ADDR; ?>
<?
$hst = $_SERVER["HTTP_HOST"];
$uri = $_SERVER["REQUEST_URI"];
$rmt = $_SERVER["REMOTE_ADDR"];
$br = $_SERVER["HTTP_USER_AGENT"];
echo "$rmt
";
?>" size="19">
<br>
<br>
<input type="submit" value="Submit" name="submit">
</form><BR><BR><CenteR><?
echo "$REMOTE_ADDR";
?>
<?php echo $REMOTE_ADDR; ?>
<?
$hst = $_SERVER["HTTP_HOST"];
$uri = $_SERVER["REQUEST_URI"];
$rmt = $_SERVER["REMOTE_ADDR"];
$br = $_SERVER["HTTP_USER_AGENT"];
echo "Your IP address : $rmt has been logged, abuse will result in a ban : \n
";
?><BR>PLEASE NOTE - YOU CAN ONLY VOTE ONCE PER DAY ONLINE</center>
<? include "bsfooter.php" ?>
And here is the page to process the data
<? include "pageheader.php" ?>
<? include "bangorstarheader.php" ?>
<?php
if(isset($_POST['submit'])) {
$to = "info@bangorfm.co.uk";
$subject = "Bangor Star Vote";
$vote = $_POST['vote'];
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$ip = $_POST['ip'];
$body = "Vote For: $vote\n From: $name\n Email: $email\n Telephone: $telephone\n Ip Address: $ip";
echo "<br>Thanks! Your vote has now been sent";
mail($to, $subject, $body);
} else {
echo "Sorry - Your Email Has Not Been Sent This Time - Please Try Again";
}
?>
<? include "bangorstarfooter.php" ?>
<? include "bsfooter.php" ?>
Any help would be appreciated!
Many thanks,
Regards
Andy Pugh