1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <?php
session_start();
$array_crypt = array('2', '3', '4', '5', '6', '7', '8', '9', 'A', 'C', 'E', 'F', 'H', 'K', 'M', 'N', 'P', 'R', 'T', 'U', 'W', 'X', 'Y', 'Z');
$taille_array_crypto = count($array_crypt) - 1;
$_SESSION['cryptogramme'] = $array_crypt[mt_rand(0, $taille_array_crypto)].$array_crypt[mt_rand(0, $taille_array_crypto)].$array_crypt[mt_rand(0, $taille_array_crypto)];
$img = imagecreatetruecolor(60, 25);
$tmpcolor = imagecolorallocate($img, 0, 0, 102);
imagefill($img, 0, 0, $tmpcolor);
$tmpcolor = imagecolorallocate($img, 255, 255, 255);
imagettftext($img, 14, mt_rand(-10, 10), 9, 20, $tmpcolor, './arial.ttf', $_SESSION['cryptogramme']);
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename="'.md5(microtime()).'.jpg"');
header('Cache-Control: no-cache, must-revalidate');
imagejpeg($img);
?> |
Partager