Skip to content

partharajbd/pd-captcha-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PD Captcha PHP

  • Name : PD Captcha PHP
  • Author : Partharaj Deb
  • Date : 23 December 2017
  • Description : This library is able to create captcha code which can be used in form to improve security.
  • Speciality : It does not generate any image file. All functionality are done in a single file (captcha.php).

Functions

  1. Create a new captcha code
pdCaptchaCreate(); 
  1. Get captcha image url to show in the user interface using img tag.
pdCaptchaImageSrc();
  1. Get captcha code in plain text to compare with user input
pdCaptchaCode();

Use of pd-captcha

session_start();
require_once "./pd-captcha-php/captcha.php"; // Path to the captcha.php


// Creates new captcha
pdCaptchaCreate(); 


// pdCaptchaImageSrc() returns the image src path.
<img src="<?= pdCaptchaImageSrc() ?>" alt="pd-captcha-php"> 


// Check user input is matches or not
// pdCaptchaCode() returns the generated captcha code in plain text
if ($userInput == pdCaptchaCode()){
  // Captcha is correct
}

Options

If you want to pass your own word and height / width of the captcha image you may use this options (NOT recommended)

$config = [
    'height' => 60,
    'width' => 165,
    'word' => 'PD27cap'
];
pdCaptchaCreate($config); 

Don't miss

Must keep captcha.php and font.ttf in the same directory

Example

See the live use in the contact form of the website- latentsoft.com

Sample 1 Sample 2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages