App\Core_Captcha

Inherited from cmsApplication_Basic

Protected Attributes

protected $iscale= 1
protected $image_height= 200
protected $image_width= 80
protected $perturbation= 0
protected $charset= 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'
protected $image_bg_color 
protected $multi_text_color= []
protected $ttf_file 
protected $text_color 
protected $use_multi_text= true
protected $use_transparent_text= true
protected $text_transparency_percentage= 10
protected $num_lines= 2
protected $line_color 
protected $noise_level= 2
protected $signature_color= []
protected $bgimg 
protected $background_directory 
protected $captcha_type 
protected $case_sensitive= false
protected $font_ratio 
protected $image_signature 
protected $securimage_path= null
protected $distortion_level= null
protected $gdtextcolor 
protected $gdnoisecolor 
protected $gdbgcolor= null
protected $noise_color= null
protected $signature_font= null
protected $code_length= null
protected $code_display= null
protected $code_entered= null
protected $code= null
protected $correct_code= null
protected $_timeToSolve= null
protected $tmpimg= null
protected $im= null
protected $gdlinecolor 
protected $gdsignaturecolor 

Public Attributes

public SI_CAPTCHA_MATHEMATIC= 1

Protected Methods

protected distortedCopy()
Copies the captcha image to the final image with distortion applied
protected string A randomly generated CAPTCHA codegenerateCode()
Generates a random captcha code from the set character set string A randomly generated CAPTCHA code string A randomly generated CAPTCHA code
protected saveData()
Save CAPTCHA data to session and database (if configured)
protected validate()
Validate a code supplied by the user Checks the entered code against the value stored in the session and/or database (if configured). Handles case sensitivity. Also removes the code from session/database if the code was entered correctly to prevent re-use attack. This function does not return a value.
protected initColor(string $color, ColorSpecs $default)
Convert an html color code to a ColorSpecs
protected allocateColors()
Allocate the colors to be used for the image
protected setBackground()
The the background color, or background image to be used
protected drawWord()
Draws the captcha code on the image
protected drawLines()
Draws distorted lines on the image
protected drawNoise()
Draws random noise on the image
protected showCaptcha()
The main image drawing routing, responsible for constructing the entire image and serving it
protected rgb($red, $green, $blue)
protected arrayhex2rgb(string $hex)
Hex to RGB. Returns an array with key ['r' => $r, 'g' => $g, 'b' => $b]

Public Methods

public __construct()
Constructor
public bool true if the given code was correct, false if not.check(string $code)
Checks a given code against the correct value from the session and/or database.
public getCode()
public createCode()
This method generates a new captcha code. Generates a random captcha code based on charset, math problem, or captcha from the wordlist and saves the value to the session and/or database.
public float Random float between 0 and 0.9999frand()
Return a random float between 0 and 0.9999
public booleanRun(string $command)
Runs command. If return value is true, then it will be displayed as a full page If return value is false, AJAX method is assumed

Public Static Methods

public static isCaptchaCodeValid()
public static getURL()