|
Hide your email address from spam-bots by requiring a CAPCHA test to be taken before displaying the address. Does not require JS. The email address is not revealed in any way (encoded, obfuscated, etc) until the surfer proves their humanity by taking the simple test.
<?php
// including file must start output buffer - ob_start();
$explanation = "
<p>Email Address:</p>
<p>Sorry, we get too much spam. <br>
You'll have to pass a little test to make sure <br>
you're human, and not a spam-bot.<br></p>";
$emailaddress = 'User@YourDomain.com';// use StudlyCaps if you want,
$thehumanstring = 'human';
$sorry = "Sorry, I guess you didnt pass the test, please try again.";
$thankyou = 'Thank you.<BR>';
$formtext = "Please type the word <strong>$thehumanstring</strong> in the box";
$thenclick = "Then click here to get our email address.";
// +++++++++++++++++++++++++++++++++++++++++++++++++
$thehumanstring = strtolower($thehumanstring);
$postlower = strtolower($_POST['humanstring']);
$formaction = $_SERVER['REQUEST_URI'];
if ($postlower == $thehumanstring){
setcookie("spambotno", "spambotno", time()+60*60*24*100, "/");
echo $thankyou;
}
if (($_COOKIE['spambotno'] == "spambotno") || ($postlower == $thehumanstring)){
?> <a href="mailto:<?php echo strtolower($emailaddress) ?>"><?php echo $emailaddress ?></a>
<?php }
if (($_COOKIE['spambotno'] != "spambotno") && ($postlower != $thehumanstring)){
echo $explanation;}
if (isset($_POST['humanstring'])){//echo 'its set';
if ($postlower != $thehumanstring){
echo $sorry;}}
if (($_COOKIE['spambotno'] != "spambotno") && ($postlower != $thehumanstring)){
?>
<form name="the_form" action="<?php echo $formaction; ?>" method="POST">
<?php echo $formtext; ?> <br>
<input type="text" name="humanstring" size="30"><br>
<input type="submit" value="<?php echo $thenclick; ?>">
</form>
<?php } ?>
<script language="JavaScript"><!--
document.the_form.humanstring.focus();
//--></script>
Sign up to add your own comment here!
|
|