|
|
|
|
|
для: Bvz
(23.12.2009 в 14:30)
| | Я - квадратной. И прикручиваю шурупами. | |
|
|
|
|
|
|
|
для: Николай2357
(23.12.2009 в 14:41)
| | блин лоханулся, я про captcha спрашиваю | |
|
|
|
|
|
|
|
для: Bvz
(23.12.2009 в 14:45)
| | Своей собственной.
В зависимости от ситуации и потребностей. | |
|
|
|
|
|
|
|
для: Bvz
(23.12.2009 в 14:45)
| | Я вот эту малость подрихтовал, вполне разумная. | |
|
|
|
|
|
|
|
для: Bvz
(23.12.2009 в 14:30)
| |
<?php
header("Expires: Mon, 23 May 1995 02:00:00 GMT\r\n"); //Запреты на кэширование
header('Last-Modified: '.gmdate('D, d M Y H:i:s')." GMT\r\n");
header("Cache-Control: no-cache, must-revalidate\r\n");
header("Pragma: no-cache\r\n");
$fonts = array('courbd.ttf','candara.ttf'); //Пути к шрифтам
$cod = "";
$length = rand(4,6);
if ($length == 4) $off = 18;
elseif ($length == 5) $off = 12;
else $off = 8;
session_start();
header("Content-type: image/gif\r\n\r\n"); //Это gif-изображение
$letters = 'abcdefhjkmnpqrstuvwxyz2345678'; //Буквы и цифры
$img = imagecreate(150,50); //Создаём изображение
$bg = imagecolorallocate($img,rand(0,127),rand(0,127),rand(0,127)); //Заливаем фон
imagefill($img,0,0,$bg);
for($a=0; $a<15; $a++){ //Забиваем линиями
$colour = imagecolorallocate($img,rand(0,127),rand(0,127),rand(0,127));
imageline($img,rand(0,150),rand(0,50),rand(0,150),rand(0,50),$colour);
}
for($a=0; $a<50; $a++){ //Забиваем точками
$colour = imagecolorallocate($img,rand(128,255),rand(128,255),rand(128,255));
imagesetpixel($img,rand(0,150),rand(0,50),$colour);
}
for($a=0; $a<$length; $a++){ //Забиваем буквами
$colour = imagecolorallocate($img,rand(128,255),rand(128,255),rand(128,255));
$letter = $letters[rand(0,strlen($letters)-1)];
if(empty($x)) $x = 8;
else $x = $x + 24 + rand(0,1.5);
$y = 30 + rand(-5,5);
$cod .= $letter;
if(1 == rand(0,1)) $letter = strtoupper($letter);
imagettftext($img,24,rand(-5,5),$x,$y,$colour,$fonts[rand(0,count($fonts)-1)],$letter);
}
for($a=0; $a<10; $a++){ //Забиваем линиями
$colour = imagecolorallocate($img,rand(128,255),rand(128,255),rand(128,255));
imageline($img,rand(0,150),rand(0,50),rand(0,150),rand(0,50),$colour);
}
$_SESSION['code'] = $cod;
imagegif($img);
?>
|
| |
|
|
|
|
|
|
|
для: ~AquaZ~
(23.12.2009 в 17:38)
| |
imagettftext($img,24,rand(-5,5),$x,$y,$colour,$fonts[rand(0,count($fonts)-1)],$letter);
|
Invalid font filename
// Replace path by your own font path | |
|
|
|
|
|
|
|
для: ValeV
(23.12.2009 в 17:56)
| | Киньте в $fonts свой список TTF-шрифтов, лежащих ф папке сайта. | |
|
|
|
|