1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <div style="width: 400px; margin: 0 auto;">
<form action="" method="post">
<?php
// Insertion recaptcha
require_once('recaptcha/recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "";
$privatekey = "";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
// Connexion à l'espace membre
echo '<form action="index.php" method="post">
Login : <input type="text" name="login" value="';
if (isset($_POST['login'])) echo htmlentities(trim($_POST['login']));
echo '"><br />Mot de passe : <input type="password" name="pass" value="';
if (isset($_POST['pass'])) echo htmlentities(trim($_POST['pass']));
echo '"><br />
<input type="submit" name="connexion" value="Connexion">
</form>
';
if (isset($erreur)) echo '<br /><br />',$erreur;
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br/>
<input type="submit" value="OK" />
</form>
</div> |