Source for file captcha_image.php
Documentation is available at captcha_image.php
* @copyright (c) 2004-15 bitweaver.org
require_once( '../kernel/setup_inc.php' );
$width = @BitBase::verifyId( $_REQUEST['width'] ) ? $_REQUEST['width'] : 140;
$height = @BitBase::verifyId( $_REQUEST['height'] ) ? $_REQUEST['height'] : 35;
$img = @imagecreate( $width, $height ) or die( "The GD image library doesn't seem to be available or doesn't have JPG support." );
$number = rand( 10000, 99999 );
$_SESSION['captcha'] = md5( $number );
for( $i = 0; $i < 5; $i++ ) {
imagestring( $img, 10, ( $width / 6 ) - 5 + ( $width / 6 ) * $i + rand( 0, 2 ), 2 + rand( 0, $height - 22 ), substr( $number, $i, 1 ), $text[rand( 0, count( $text ) - 1 )] );
if( $gd["PNG Support"] ) {
header( "Content-type: image/png" );
} elseif( $gd["GIF Create Support"] ) {
header( "Content-type: image/gif" );
header( "Content-type: image/jpeg" );
|