kieranbarnes Independent PHP, WordPress & CubeCart Programmer

CAPTCHA Image Generation Part 2

Posted on July 19, 2007

A quick morning hack - I added some random lines to try and confuse the automated processes. Its probably still not very secure but it's a start!

Add the following code below the last imagettftext() line.

$image_info = getimagesize("badge4.png");
$i = 1;
while ($i <= 10) {
$random_line_colour = ImageColorAllocate($base_image, rand(0,255), rand(0,255), rand(0,255));
imageline($base_image,rand(10,$image_info[0]), rand(10,$image_info[1]), rand(10,$image_info[0]), rand(10,$image_info[1]),$random_line_colour);
$i++;
}

It will end up similiar to this

untitled1.PNG


Related posts

  1. KB_CAPTCHA – CAPTCHA Image Generation in PHP
    Introduction KB_Captcha is a simple PHP script to generate reasonably safe CAPTCHA image to secure...
  2. CAPTCHA Image Generation
    I couldn't find a very good CAPTCHA generation script in PHP, all the ones I...
  3. Yellow text?
    I stumbled over a strange bug on two systems the other day where the imagettftext()...
  4. iCalendar Generation
    One of my clients requested that the CRM applicationI wrote should interact with Outlook Calender....
  5. JPGraph Part 1
    I really like JPGraph now. For too long I hated it as a clunky, bloated...

Posted by Kieran


Filed under: PHP Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.