├── LICENSE ├── README.md ├── captcha-generator ├── asset │ ├── main.js │ └── redo-alt-solid.svg ├── captcha.php ├── fonts │ ├── 1.ttf │ ├── 10.ttf │ ├── 2.ttf │ ├── 3.ttf │ ├── 4.ttf │ ├── 5.ttf │ ├── 6.ttf │ ├── 7.ttf │ ├── 8.ttf │ └── 9.ttf └── img_gen.php ├── example.php ├── screenshot ├── img0.png └── img1.png └── validate.php /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Tarun Kumar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Captcha Generator [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/tarunk04/Captcha_Generator/blob/master/LICENSE) 2 | ================= 3 | 4 | It is a simple PHP program to generate captcha for form validation. It can be integrated in any website for captcha generation. This project is based on converting text to image using PHP with help of GD. It create 4 character and converts it to image. 5 | 6 | Silent Features 7 | ================ 8 | * Each 4 character have different font , random font from the set of 10 fonts. 9 | * Each character has different colour, font size, orientation and position 10 | * Final captcha has many lines with different orientation, size, position and colour.
11 | ![g](/screenshot/img0.png) ![g](/screenshot/img1.png) 12 | 13 | Installation 14 | ================ 15 | * Clone this repository: 16 | ```console 17 | git clone https://github.com/tarunk04/Captcha_Generator 18 | ``` 19 | or click `Download ZIP` in right panel of repository and extract it. 20 | * Copy `captcha-generator` folder into the project directory. 21 | * Copy this line to HTML or PHP file of the project. 22 | ```html 23 |
24 | ``` 25 | * Copy this script import line at the bottom of the body of same HTML or PHP file. 26 | ```html 27 | 28 | ``` 29 | Validating captcha 30 | =================== 31 | * Create a form with a `Text Field` and `Button` to send the user input to server using `POST` method. 32 | * On server side use session variable `$_SESSION['secure']` for validating captch. For example: 33 | ```php 34 | 43 | ``` 44 | --------------------------------------------- 45 | -------------------------------------------------------------------------------- /captcha-generator/asset/main.js: -------------------------------------------------------------------------------- 1 | 2 | document.getElementById('ae_captcha_api').innerHTML = "
"; 3 | 4 | function newcaptcha(){ 5 | var dataString = 'index=1'; 6 | var url = "./captcha-generator/captcha.php" 7 | var xhttp = new XMLHttpRequest(); 8 | xhttp.onreadystatechange = function() { 9 | if (this.readyState == 4 && this.status == 200) { 10 | html = this.responseText; 11 | if (html!=1){ 12 | document.getElementById('divcaptcha').innerHTML = html; 13 | } 14 | } 15 | }; 16 | xhttp.open("POST", url, true); 17 | xhttp.send(); 18 | } 19 | -------------------------------------------------------------------------------- /captcha-generator/asset/redo-alt-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /captcha-generator/captcha.php: -------------------------------------------------------------------------------- 1 | 11 |
12 | 13 |
14 | -------------------------------------------------------------------------------- /captcha-generator/fonts/1.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/1.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/10.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/10.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/2.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/3.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/3.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/4.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/4.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/5.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/5.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/6.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/6.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/7.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/7.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/8.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/8.ttf -------------------------------------------------------------------------------- /captcha-generator/fonts/9.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/captcha-generator/fonts/9.ttf -------------------------------------------------------------------------------- /captcha-generator/img_gen.php: -------------------------------------------------------------------------------- 1 | 65 | -------------------------------------------------------------------------------- /example.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example Captcha 6 | 7 | 8 |
9 |
10 |
11 |
12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /screenshot/img0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/screenshot/img0.png -------------------------------------------------------------------------------- /screenshot/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarunk04/Captcha_Generator/4f710a6a52a8c8c8f78d6b6b7fc317d0beb6411a/screenshot/img1.png -------------------------------------------------------------------------------- /validate.php: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------