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
|
<?php
session_start();
$image = imagecreate(73,25);
$couleurfond = imagecolorallocate($image, 255,255, 255);
$couleurpolice = imagecolorallocate($image,45,158,184);
$couleurtrait = imagecolorallocate($image, 55, 85, 114);
imagefill($image,0,0,$couleurfond);
$nbr = rand(235684,999999);
$md5 = md5($nbr);
$code = substr($md5,0,5);
$_SESSION['code_image_cmd'] = $code;
imagestring($image,5,15,5,$code,$couleurpolice);
for($i=0;$i<3;$i++)
{
$rand_startX[$i] = rand(0,25);
$rand_endX[$i] = rand(50, 73);
$rand_startY[$i] = rand(0,5);
$rand_endY[$i] = rand(0, 73);
imageline($image,$rand_startX[$i],$rand_startY[$i],$rand_endX[$i],$rand_endY[$i],$couleurtrait);
}
imagepng($image);
?> |
Partager