rechargement du nouveau captcha

This commit is contained in:
Deltacms 2024-01-06 09:12:08 +01:00
parent 7b4c780a49
commit ea65f401df
7 changed files with 36 additions and 0 deletions

36
core/vendor/captcha/captcha.php vendored Normal file
View File

@ -0,0 +1,36 @@
<?php
session_start();
if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/');
function random($tab) {
return $tab[array_rand($tab)];
}
$chars = '0123456789';
$char1 = mt_rand( 0, strlen($chars) - 1 );
$char2 = mt_rand( 0, strlen($chars) - 1 );
$_SESSION['captcha'] = md5((int)$char1 + (int)$char2);
// polices utilisées
$fonts = glob('polices/*.ttf');
// création de l'image captcha
$image = imagecreatefrompng('captcha.png');
// couleurs des caractères
$colors = array ( imagecolorallocate($image, 238, 238, 238),
imagecolorallocate($image, 51, 51, 51),
imagecolorallocate($image, 0, 102, 153),
imagecolorallocate($image, 204, 0, 51),
imagecolorallocate($image, 255, 51, 51),
imagecolorallocate($image, 51, 255, 51),
imagecolorallocate($image, 255, 255, 51) );
// positions, polices, caractères et couleurs randomisées
imagettftext($image, 28, -10, 7, 50, random($colors), ABSPATH .'/'. random($fonts), $char1);
imagettftext($image, 28, 0, 50, 50, random($colors), ABSPATH .'/'. 'polices/Eskiula.ttf', '+');
imagettftext($image, 28, -35, 75, 50, random($colors), ABSPATH .'/'. random($fonts), $char2);
imagettftext($image, 28, 0, 125, 50, random($colors), ABSPATH .'/'. 'polices/Eskiula.ttf', '=');
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>

BIN
core/vendor/captcha/captcha.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
core/vendor/captcha/polices/AnkeCall.ttf vendored Normal file

Binary file not shown.

BIN
core/vendor/captcha/polices/Eskiula.ttf vendored Normal file

Binary file not shown.

BIN
core/vendor/captcha/polices/GLIMSTIC.ttf vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
core/vendor/captcha/reload.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB