Created
November 21, 2012 15:38
-
-
Save jpveilleux/4125500 to your computer and use it in GitHub Desktop.
Code de styling d'erreur pour le reCaptcha
This file contains 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
// ############################################################################# | |
// reCAPTCHA ############################################################### | |
require_once('recaptchalib.php'); | |
$privatekey = "6LfeTNkSAAAAAF1prTp7VAwWPGZJZzhW2fioA40f"; | |
$resp = recaptcha_check_answer ($privatekey, | |
$_SERVER["REMOTE_ADDR"], | |
$_POST["recaptcha_challenge_field"], | |
$_POST["recaptcha_response_field"]); | |
$captcha_error['fr'] = " | |
<html lang='en'> | |
<head> | |
<meta charset='utf-8' /> | |
<style> | |
body{ | |
font-family: Arial, sans-serif; | |
} | |
.error-container{ | |
width: 600px; | |
margin: 0 auto; | |
padding: 15px; | |
background: #accd34; | |
border: 2px solid #81a21c; | |
} | |
h3{ | |
margin-top: 0; | |
padding-top: 0; | |
color: #fff; | |
font-size: 150%; | |
} | |
p{ | |
font-size: 110%; | |
margin-bottom: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='error-container'> | |
<h3>Oops! - Mauvaise réponse</h3><p>La réponse que vous avez entrée pour la question <strong>Sécurité Anti-Spam</strong> n'était pas correct. Veuillez faire précédent et réessayer de nouveau.</p> | |
</div> | |
</body> | |
</html> | |
"; | |
$captcha_error['en'] = " | |
<html lang='en'> | |
<head> | |
<meta charset='utf-8' /> | |
<style> | |
body{ | |
font-family: Arial, sans-serif; | |
} | |
.error-container{ | |
width: 600px; | |
margin: 0 auto; | |
padding: 15px; | |
background: #accd34; | |
border: 2px solid #81a21c; | |
} | |
h3{ | |
margin-top: 0; | |
padding-top: 0; | |
color: #fff; | |
font-size: 150%; | |
} | |
p{ | |
font-size: 110%; | |
margin-bottom: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='error-container'> | |
<h3>Oops! - Wrong Answer</h3><p>The answer you provided for the <strong>Anti-Spam Security</strong> question wasn't correct. Go back and try it again.</p> | |
</div> | |
</body> | |
</html> | |
"; | |
// Then you check this variable to know if all went well: | |
if (!$resp->is_valid) { | |
die ($captcha_error[$_POST['langue']]); // Displays the html above | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment