Created
May 12, 2010 16:08
-
-
Save avit/398765 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$revcaptcha = md5($_SERVER['REMOTE_ADDR'] . 'random_salt'); | |
function check_revcaptcha($key1, $key2, $revcaptcha) { | |
if ($_POST[$key1] == '' && $_POST[$key2] == $revcaptcha) { | |
unset( $_POST[$key1] ); | |
unset( $_POST[$key2] ); | |
return true; | |
} else { | |
return false; | |
} | |
} | |
if ( $_POST && check_revcaptcha('url_1', 'url_2', $revcaptcha) ) { | |
send_contact_email(); | |
$flash = "Thank you, your form was sent, we will get back to you shortly."; | |
} | |
?> | |
<html> | |
<head><title>contact us</title></head> | |
<style> | |
.rc { display:none } | |
</style> | |
<body> | |
<div id="flash"><?= $flash ?></div> | |
<form method="POST" action="<?= $_SERVER['PHP_SELF'] ?>"> | |
<input name="message"> | |
<!-- hidden for reverse captcha --> | |
<input type="text" name="url_1" value="" class="rc"> | |
<input type="text" name="url_2" value="<?= $revcaptcha ?>" class="rc"> | |
<!-- end hidden --> | |
<input type="submit" name="submit" value="Send"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment