I’m creating a web page for a kiosk at a building entrance, so there will be 4 buttons on one page with each department’s name on. Everytime when a button is clicked, an email will be sent to an appropriate department email address to inform a visitor is here.
I posted another related question, someone said there will be a security hole there, because the departments will get a lot of spams since this is going to be hosted on my company’s subdomain. What is the best way to overcome it? Can I use some php code to fix the spam issue?
Any code or useful links would be appreciated.
Here is the code I’m using at the moment, I can change it entirely if you have some better suggestions. Thanks.
<form action="" method="post">
<input type="submit" value="Send details to A" />
<input type="hidden" name="button_a" value="1" />
</form>
<?php
if(isset($_POST['button_a']))
{
$to = 'name@ourcompany.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@ourcompany.com' . "\r\n" .
'Reply-To: webmaster@ourcompany.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo 'Email Sent.';
}
?>
First thing you can do is find out the IP address of the Kiosk and only allow that.