Hej udvikleren.
Jeg har følgende contact form
<?php
function spamcheck($field)
{
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
{//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
?>
<div style="text-align: left;">Invalid e-mail, please try again! <br />
<a href="http://www.kp-foto.com/contact/">back to contact form</a></div>
<?php
}
else
{
//send email
$SIGN = KP-FOTO.COM ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("mail@kp-foto.com", "$subject",
$message, "From: KP-FOTO.COM $email");
mail("$email", "Thank you for you message to KP-FOTO!","Thank you for your message to KP-FOTO! KP-FOTO will contact you as soon as possible!
Best regards
KP-FOTO
http://www.kp-foto.com", "From: mail@kp-foto.com");
?>
<div style="text-align: left;">
<p>Thank you for your message! <br />
<strong>KP-FOTO</strong> will contact you as soon as possible!</p>
</div>
<?php
}
}
else
{
?>
</p>
<div style="text-align: left;"><form method='post' action='
http://www.kp-foto.com/contact/'> <p>Feel free to send KP-FOTO a message!<br />
<strong>Name:
</strong><br />
<input type='text' name='name' />
<br />
<strong>E-mail: </strong><br />
<input name='email' type='text' /><br />
<strong>Subject: </strong><br />
<input name='subject' type='text' /><br />
<strong>Message:</strong><br />
<textarea name='message' rows='15' cols='40'>
</textarea> <br />
<input type='submit' value="Send" onMouseOver="this.className='TheTextOn'" onMouseOut="this.className='TheTextOff'" />
</p>
</form></div>
<?php
}
?>
Jeg kunne godt tænke mig noget security på den, da jeg har haft en del problemer spam.
Jeg forestiller mig noget i den her dur:
<input type="password" name="security_code">
<img src="../../CaptchaSecurityImages.php?width=100&height=40&characters=5">
Men kan ikke finde ud af at implementere tjekket i php koden.
Nogen der kan hjælpe?