phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


CAPTCHA - part 4 : "Are you human or ....?" (Modify Your CAPTCHA)

Tag: captcha, security   Category: PHP Security, PHP Classes
post: 19 Oct 2007 read: 1,854


PHP CAPTCHA Tutorial: Now, we try modification this class. This is last result our practice: <img phpspeedo_captcha3_2>

Yo see, we can not see perfect. So we must modify that dimension. Open captcha.class.php. Give attention at line (118):

      imagettftext($image, 25, 0, 8, 22,
                   $stringcolor,
                   $this->Font,
                   $this->CaptchaString);

This (imagettftext) is php function. Write text to the image using TrueType fonts. It have formula: array imagettftext ( resource image, int size, int angle, int x, int y, int color, string fontfile, string text )

Let I try size become 20, the result is:

You can try another parameter as you like.

The last, how if we want just for 4 digit? Open captcha.php. Find this line:


  //Create a CAPTCHA
  $captcha = new captcha(4);
modify become:
  //Create a CAPTCHA
  $captcha = new captcha();

Oke, I hope this tutorial usefull for you. Give your comment please.



Series this article:
CAPTCHA - part 1 : "Are you human or ....?" (Introduction)
CAPTCHA - part 2: "Are you human or ....?"
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)
CAPTCHA - part 4 : "Are you human or ....?" (Modify Your CAPTCHA)

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting