How To Make A Captcha Code

Table of contents:

How To Make A Captcha Code
How To Make A Captcha Code

Video: How To Make A Captcha Code

Video: How To Make A Captcha Code
Video: How to create captcha in html form 2024, May
Anonim

Captcha is a special test that offers users a problem that anyone can easily solve, but which is almost impossible for a computer to master. In order to protect your site from automatic registrations, spam or automatic downloads of files, you need to create a captcha code.

How to make a captcha code
How to make a captcha code

Necessary

scripts for generating captcha-code

Instructions

Step 1

Use a ready-made solution - go to the KCaptcha project website, download it for free and install it on your website.

Step 2

Use Google's ReCaptcha program - go to the website, click the Sign up Now button, register and paste the code.

Step 3

Create a sec_pic.php file in PHP Notepad. Open notepad and paste the script shown in the picture into it. Use line 1-2 to set the width and height of the captcha image. Line 3 is responsible for the font size. The fourth and fifth lines regulate the number of characters that need to be typed and which will be displayed on the background of the captcha.

Step 4

On line 6, specify the path to the font that will be used in the captcha code. Use line 13 to create the image directly. On line 14, define the background color of the captcha. Fill the image with the background using line 15. Line 17 is responsible for adding letters or numbers to the background. Define random colors, symbols and sizes on lines 20, 22 and 24, respectively.

Step 5

On line 37, specify the offset of each character. Translate the code into a line in line 43 of the script. Line 45 will display the finished captcha image. Click File → Save. Select everything in the line with the title and type there captca.php. Output the image of the captcha code via HTML using a script. Upload the captcha code to your website.

Step 6

If the scripts from the previous paragraphs do not work, use the script from the suggested picture. Create it in notepad and save it with.php extension. Specify in lines 2, 3 and 4 the width, height and length, respectively, of the captca code. On lines 9 and 10, specify the characters used in the code (letters and numbers) and the components that will be used to create the color.

Step 7

Use line 13 to create the background of the verification code image. On line 16, specify the width to accommodate one character. Use line 18 to fill the background with random dots to reduce the risk of captcha recognition by bots. Generate a random color on line 19. On line 27, print a random dot for safety.

Step 8

Apply the security code on line 31. Generate a random character on line 38. Set the coordinates of the character output using line 41. Line 49 will help you set the angle of rotation of any character that will be displayed on the picture of the confirmation code. Print the generated symbol to images using line 52. Save according to the previously suggested algorithm.

Recommended: