eu queria colocar uma captcha do genero desta, mas não estou a conseguir http://www.hardcode.nl/subcategory_4/artic...tcha-script.htm coloquei agora a zona da captcha no formulario <form id="contact-form">
<p id="formstatus"></p>
<p>Olá, EstradaNetworks!</p>
<label for="email">Sua mensagem : </label>
<textarea name="message" value="Your Message" id="message" ></textarea>
<p>Cumprimentos,</p>
<label for="name">Nome: </label>
<input type="text" name="name" value="" id="name" />
<label for="email">Email: </label>
<input type="text" name="email" value="" id="email" />
<input class="input" type="text" name="norobot" />
<img src="captcha.php" />
<input type="submit" name ="submit" value="Enviar agora! Obrigado!" />
</form>
e no ficheiro send.php, coloquei isto:
<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/
*/
/////////// Add your own email below ////////////////
define("WEBMASTER_EMAIL", '....................@gmail.com');
error_reporting (E_ALL ^ E_NOTICE);
//////////////////////////////////////////////////////
session_start();
if (md5($_POST['norobot']) == $_SESSION['randomnr2']) {
// here you place code to be executed if the captcha test passes
echo "";
} else {
// here you place code to be executed if the captcha test fails
echo "Você é um mau robot!";
}
function ValidateEmail($email)
{
$regex = '/([a-z0-9_.-]+)'. # name
'@'. # at
'([a-z0-9.-]+){2,255}'. # domain & possibly subdomains
'.'. # period
'([a-z]+){2,10}/i'; # domain extension
if($email == '')
return false;
else
$eregi = preg_replace($regex, '', $email);
return empty($eregi) ? true : false;
}
//////////////////////////////////////////////////////
$post = (!empty($_POST)) ? true : false;
if($post)
{
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$error = '';
// Check name
if(!$name || $name == "Name*")
$error .= 'Por favor, coloque o seu nome.<br />';
// Check email
if(!$email || $email == "Email*")
$error .= 'Por favor, coloque seu email.<br />';
if($email && !ValidateEmail($email))
$error .= 'Por favor, coloque um email válido.<br />';
// Check message
if(!$message)
$error .= "Por favor, escreva a sua mensagem. <br />";
if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());
if($mail)
echo 'OK';
}
else
echo '<div class="formstatuserror">'.$error.'</div>';
}
?> agora aparece o texto de erro se a captcha estiver em branco ou errada e o texto se a captcha estiver correcta mas o email é enviado a mesma, quer ela esteja errada ou completa ninguém pode dar ai uma ajuda