|
noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
|
Collaboration diagram for Securimage:Public Member Functions | |
| __construct () | |
| Class constructor. | |
| addSignature () | |
| Print signature text on image. | |
| allocateColors () | |
| Allocate all colors that will be used in the CAPTCHA image. | |
| check ($code) | |
| Validate the code entered by the user. | |
| checkCode () | |
| Check if the user entered code was correct. | |
| clearCodeFromDatabase () | |
| Delete a code from the database by ip address hash. | |
| createCode () | |
| Create a code and save to the session. | |
| distortedCopy () | |
| Warp text from temporary image onto final image. | |
| doImage () | |
| Generate and output the image. | |
| drawLines () | |
| Draw random curvy lines over the image Modified code from HKCaptcha. | |
| drawWord () | |
| Draw the CAPTCHA code over the image. | |
| frand () | |
| Generate random number less than 1. | |
| generateCode ($len) | |
| Generate a code. | |
| generateMP3 ($letters) | |
| Generate an mp3 file by concatenating individual files. | |
| generateWAV ($letters) | |
| Generate a wav file by concatenating individual files. | |
| getAudibleCode ($format='wav') | |
| Get WAV or MP3 file data of the spoken code. | |
| getBackgroundFromDirectory () | |
| Return the full path to a random gif, jpg, or png from the background directory. | |
| getCode () | |
| Get the captcha code. | |
| getCodeFromDatabase () | |
| Get stored captcha code from sqlite database based on ip address hash. | |
| getIPHash () | |
| Get hashed IP address of remote user. | |
| isCodeExpired ($creation_time) | |
| Check a code to see if it is expired based on creation time. | |
| openDatabase () | |
| Open SQLite database. | |
| output () | |
| Output image to the browser. | |
| outputAudioFile () | |
| Output audio file with HTTP headers to browser. | |
| purgeOldCodesFromDatabase () | |
| Purge codes over a day old from database. | |
| readCodeFromFile () | |
| Reads a word list file to get a code. | |
| saveCodeToDatabase () | |
| Save captcha code to sqlite database. | |
| saveData () | |
| Save the code in the session. | |
| scrambleAudioData (&$data, $format) | |
| Randomly modify the audio data to scramble sound and prevent binary recognition. | |
| setAudioPath ($audio_directory) | |
| Set the path to the audio directory. | |
| setBackground () | |
| Set the background of the CAPTCHA image. | |
| show ($background_image="") | |
| Generate a code and output the image to the browser. | |
| validate () | |
| Validate the code to the user code. | |
Definition at line 107 of file securimage.php.
| Securimage::__construct | ( | ) |
Class constructor.
Because the class uses sessions, this will attempt to start a session if there is no previous one.
If you do not start a session before calling the class, the constructor must be called before any output is sent to the browser.
$securimage = new Securimage();
Definition at line 506 of file securimage.php.
References audio_format, code_length, image_bg_color, image_height, image_signature, image_type, image_width, line_color, multi_text_color, num_lines, perturbation, signature_color, text_angle_maximum, text_angle_minimum, text_color, text_transparency_percentage, use_multi_text, use_transparent_text, and use_wordlist.
| Securimage::addSignature | ( | ) |
Print signature text on image.
Definition at line 1376 of file securimage.php.
References image_height, image_signature, and image_width.
Referenced by doImage().
| Securimage::allocateColors | ( | ) |
Allocate all colors that will be used in the CAPTCHA image.
Definition at line 692 of file securimage.php.
References $color, elseif, image_bg_color, line_color, multi_text_color, signature_color, text_color, text_transparency_percentage, use_multi_text, and use_transparent_text.
Referenced by doImage().
| Securimage::check | ( | $code | ) |
Validate the code entered by the user.
$code = $_POST['code']; if ($securimage->check($code) == false) { die("Sorry, the code entered did not match."); } else { $valid = true; }
| string | $code | The code the user entered |
Definition at line 605 of file securimage.php.
References $code, and validate().
Here is the call graph for this function:| Securimage::checkCode | ( | ) |
Check if the user entered code was correct.
@access private
Definition at line 1215 of file securimage.php.
| Securimage::clearCodeFromDatabase | ( | ) |
Delete a code from the database by ip address hash.
@access private
Definition at line 1486 of file securimage.php.
References getIPHash().
Referenced by validate().
Here is the call graph for this function:| Securimage::createCode | ( | ) |
Create a code and save to the session.
@access private
Definition at line 996 of file securimage.php.
References code_length, generateCode(), readCodeFromFile(), saveData(), and use_wordlist.
Referenced by doImage(), and getAudibleCode().
Here is the call graph for this function:| Securimage::distortedCopy | ( | ) |
Warp text from temporary image onto final image.
Modified for securimage
@access private
Definition at line 936 of file securimage.php.
References $c, $i, $ix, $r, $rad, $tmp, frand(), image_height, image_width, and perturbation.
Referenced by doImage().
Here is the call graph for this function:| Securimage::doImage | ( | ) |
Generate and output the image.
@access private
Definition at line 652 of file securimage.php.
References addSignature(), allocateColors(), bgimg, createCode(), distortedCopy(), drawLines(), drawWord(), image_height, image_signature, image_width, num_lines, output(), setBackground(), and use_transparent_text.
Referenced by show().
Here is the call graph for this function:| Securimage::drawLines | ( | ) |
Draw random curvy lines over the image
Modified code from HKCaptcha.
Definition at line 813 of file securimage.php.
References $i, $line, $n, $step, $w, frand(), image_height, and image_width.
Referenced by doImage().
Here is the call graph for this function:| Securimage::drawWord | ( | ) |
Draw the CAPTCHA code over the image.
@access private
Definition at line 853 of file securimage.php.
References $i, image_height, image_width, multi_text_color, text_angle_maximum, text_angle_minimum, and use_multi_text.
Referenced by doImage().
| Securimage::frand | ( | ) |
Generate random number less than 1.
Definition at line 1364 of file securimage.php.
Referenced by distortedCopy(), and drawLines().
| Securimage::generateCode | ( | $len | ) |
Generate a code.
@access private
| int | $len | The code length |
Definition at line 1018 of file securimage.php.
Referenced by createCode().
| Securimage::generateMP3 | ( | $letters | ) |
Generate an mp3 file by concatenating individual files.
| array | $letters | Array of letters to build a file from |
Definition at line 1336 of file securimage.php.
References $data, $letter, and scrambleAudioData().
Referenced by getAudibleCode().
Here is the call graph for this function:| Securimage::generateWAV | ( | $letters | ) |
Generate a wav file by concatenating individual files.
| array | $letters | Array of letters to build a file from |
Definition at line 1228 of file securimage.php.
References $data, $file, $header, $i, $letter, $p, and scrambleAudioData().
Referenced by getAudibleCode().
Here is the call graph for this function:| Securimage::getAudibleCode | ( | $format = 'wav' | ) |
Get WAV or MP3 file data of the spoken code.
This is appropriate for output to the browser as audio/x-wav or audio/mpeg
Definition at line 1104 of file securimage.php.
References $code, $i, createCode(), generateMP3(), generateWAV(), and getCode().
Referenced by outputAudioFile().
Here is the call graph for this function:| Securimage::getBackgroundFromDirectory | ( | ) |
Return the full path to a random gif, jpg, or png from the background directory.
@access private
Definition at line 786 of file securimage.php.
References $file, and background_directory.
Referenced by setBackground().
| Securimage::getCode | ( | ) |
Get the captcha code.
Definition at line 1198 of file securimage.php.
References getCodeFromDatabase(), and openDatabase().
Referenced by getAudibleCode().
Here is the call graph for this function:| Securimage::getCodeFromDatabase | ( | ) |
Get stored captcha code from sqlite database based on ip address hash.
@access private
Definition at line 1460 of file securimage.php.
References $code, $res, getIPHash(), and isCodeExpired().
Referenced by getCode(), and validate().
Here is the call graph for this function:| Securimage::getIPHash | ( | ) |
Get hashed IP address of remote user.
@access private
Definition at line 1398 of file securimage.php.
Referenced by clearCodeFromDatabase(), getCodeFromDatabase(), and saveCodeToDatabase().
| Securimage::isCodeExpired | ( | $creation_time | ) |
Check a code to see if it is expired based on creation time.
@access private
| $creation_time | unix timestamp of code creation time |
Definition at line 1519 of file securimage.php.
Referenced by getCodeFromDatabase(), and validate().
| Securimage::openDatabase | ( | ) |
Open SQLite database.
@access private
Definition at line 1410 of file securimage.php.
Referenced by getCode(), saveCodeToDatabase(), and validate().
| Securimage::output | ( | ) |
Output image to the browser.
@access private
Definition at line 1066 of file securimage.php.
References exit, and image_type.
Referenced by doImage().
| Securimage::outputAudioFile | ( | ) |
Output audio file with HTTP headers to browser.
$sound = new Securimage(); $sound->audio_format = 'mp3'; $sound->outputAudioFile();
Definition at line 623 of file securimage.php.
References $ext, audio_format, exit, and getAudibleCode().
Here is the call graph for this function:| Securimage::purgeOldCodesFromDatabase | ( | ) |
Purge codes over a day old from database.
@access private
Definition at line 1501 of file securimage.php.
References $limit.
| Securimage::readCodeFromFile | ( | ) |
Reads a word list file to get a code.
@access private
Definition at line 1035 of file securimage.php.
References $data, $end, $max, and $start.
Referenced by createCode().
| Securimage::saveCodeToDatabase | ( | ) |
Save captcha code to sqlite database.
@access private
Definition at line 1437 of file securimage.php.
References $code, getIPHash(), and openDatabase().
Referenced by saveData().
Here is the call graph for this function:| Securimage::saveData | ( | ) |
Save the code in the session.
@access private
Definition at line 1147 of file securimage.php.
References saveCodeToDatabase().
Referenced by createCode().
Here is the call graph for this function:| Securimage::scrambleAudioData | ( | & | $data, |
| $format ) |
Randomly modify the audio data to scramble sound and prevent binary recognition.
Take care not to "break" the audio file by leaving the header data intact.
| $data | Sound data in mp3 of wav format |
Definition at line 1309 of file securimage.php.
References $data, $i, and $start.
Referenced by generateMP3(), and generateWAV().
| Securimage::setAudioPath | ( | $audio_directory | ) |
Set the path to the audio directory.
Definition at line 1131 of file securimage.php.
| Securimage::setBackground | ( | ) |
Set the background of the CAPTCHA image.
@access private
Definition at line 746 of file securimage.php.
References $img, background_directory, bgimg, getBackgroundFromDirectory(), image_height, and image_width.
Referenced by doImage().
Here is the call graph for this function:| Securimage::show | ( | $background_image = "" | ) |
Generate a code and output the image to the browser.
<?php include 'securimage.php'; $securimage = new Securimage(); $securimage->show('bg.jpg'); ?>
| string | $background_image | The path to an image to use as the background for the CAPTCHA |
Definition at line 582 of file securimage.php.
References bgimg, and doImage().
Here is the call graph for this function:| Securimage::validate | ( | ) |
Validate the code to the user code.
@access private
Definition at line 1161 of file securimage.php.
References $code, $code_entered, clearCodeFromDatabase(), getCodeFromDatabase(), isCodeExpired(), and openDatabase().
Referenced by check().
Here is the call graph for this function:| Securimage::$audio_format |
Definition at line 348 of file securimage.php.
| Securimage::$audio_path |
Definition at line 341 of file securimage.php.
| Securimage::$background_directory = null |
Definition at line 248 of file securimage.php.
| Securimage::$bgimg |
Definition at line 420 of file securimage.php.
| Securimage::$charset |
Definition at line 145 of file securimage.php.
| Securimage::$code |
Definition at line 428 of file securimage.php.
Referenced by check(), generateCode(), getAudibleCode(), getCodeFromDatabase(), saveCodeToDatabase(), and validate().
| Securimage::$code_entered |
Definition at line 436 of file securimage.php.
Referenced by validate().
| Securimage::$code_length |
Definition at line 136 of file securimage.php.
| Securimage::$correct_code |
Definition at line 444 of file securimage.php.
| Securimage::$draw_lines_over_text |
Definition at line 316 of file securimage.php.
| Securimage::$expiry_time |
Definition at line 366 of file securimage.php.
| Securimage::$gd_font_file |
Definition at line 169 of file securimage.php.
| Securimage::$gd_font_size |
Definition at line 178 of file securimage.php.
| Securimage::$gdbgcolor |
Definition at line 492 of file securimage.php.
| Securimage::$gdlinecolor |
Definition at line 460 of file securimage.php.
| Securimage::$gdmulticolor |
Definition at line 468 of file securimage.php.
| Securimage::$gdsignaturecolor |
Definition at line 484 of file securimage.php.
| Securimage::$gdtextcolor |
Definition at line 476 of file securimage.php.
| Securimage::$im |
Definition at line 395 of file securimage.php.
| Securimage::$image_bg_color |
Definition at line 237 of file securimage.php.
| Securimage::$image_height |
Definition at line 121 of file securimage.php.
| Securimage::$image_signature |
Definition at line 324 of file securimage.php.
| Securimage::$image_type |
Definition at line 129 of file securimage.php.
| Securimage::$image_width |
Definition at line 114 of file securimage.php.
| Securimage::$iscale |
Definition at line 412 of file securimage.php.
| Securimage::$line_color |
Definition at line 308 of file securimage.php.
| Securimage::$multi_text_color |
Definition at line 273 of file securimage.php.
| Securimage::$num_lines |
Definition at line 301 of file securimage.php.
| Securimage::$perturbation |
Definition at line 202 of file securimage.php.
| Securimage::$session_name = '' |
Definition at line 357 of file securimage.php.
| Securimage::$signature_color |
Definition at line 332 of file securimage.php.
| Securimage::$sqlite_database |
Definition at line 377 of file securimage.php.
| Securimage::$sqlite_handle |
Definition at line 452 of file securimage.php.
| Securimage::$text_angle_maximum |
Definition at line 221 of file securimage.php.
| Securimage::$text_angle_minimum |
Definition at line 212 of file securimage.php.
| Securimage::$text_color |
Definition at line 258 of file securimage.php.
| Securimage::$text_transparency_percentage |
Definition at line 290 of file securimage.php.
| Securimage::$text_x_start |
Definition at line 230 of file securimage.php.
| Securimage::$tmpimg |
Definition at line 403 of file securimage.php.
| Securimage::$ttf_file |
Definition at line 194 of file securimage.php.
| Securimage::$use_gd_font |
Definition at line 185 of file securimage.php.
| Securimage::$use_multi_text |
Definition at line 266 of file securimage.php.
| Securimage::$use_sqlite_db |
Use an SQLite database for storing codes as a backup to sessions.
Note: Sessions will still be used
Definition at line 383 of file securimage.php.
| Securimage::$use_transparent_text |
Definition at line 281 of file securimage.php.
| Securimage::$use_wordlist = false |
Definition at line 159 of file securimage.php.
| Securimage::$wordlist_file |
Definition at line 152 of file securimage.php.