1 (edited by Mediator 2005-03-20 21:52)

Topic: Image Verification - 1.0.3

##
##
##        Mod title:  Image Verification 
##
##      Mod version:  1.0.3
##   Works on PunBB:  1.2.3, 1.2.4 
##     Release date:  03-19-05 
##           Author:  Caleb Champlin (Mediator) [med_mediator@hotmail.com] 
##
##      Description:  This gives administrators the option to use image verification for registering users instead of only email. You can still use email or not use email, it doesn't really matter 
##
##       Affects DB:  Yes 
##
##   Affected files:  admin_options.php 
##                    register.php 
##                    lang/LANGUAGE/register.php 
##
##            Notes:  This modification uses GD and sessions. 
##
##     Generated By:  Auto Read-Me(by Caleb Champlin) - http://www.rscheatnet.com/Auto_Readme.zip
##
##       DISCLAIMER:  Please note that 'mods' are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##

Please note this is the first version of this modification and although it should work it has not been heavily tested by myself. If you find any bugs please post them. Thanks

Download: http://www.punres.org/viewtopic.php?id=281
Mirror: http://www.rscheatnet.com/Image_Verification-1.0.3.zip


GD
From PHP Manual

Installation
To enable GD-support configure PHP --with-gd[=DIR], where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option --with-gd. GD library requires libpng and libjpeg to compile. 

In Windows, you'll include the GD2 DLL php_gd2.dll as an extension in php.ini. The GD1 DLL php_gd.dll was removed in PHP 4.3.2. Also note that the preferred truecolor image functions, such as imagecreatetruecolor(), require GD2. 

Note: To enable exif support in Windows, php_mbstring.dll must be loaded prior to php_exif.dll in php.ini. 

To disable GD support in PHP 3 add --without-gd to your configure line. 

Enhance the capabilities of GD to handle more image formats by specifying the --with-XXXX configure switch to your PHP configure line.
I enjoy pie :)

Re: Image Verification - 1.0.3

Nice smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Image Verification - 1.0.3

a good way to stop spammers

can we give Mediator the Most Mods in a day award wink

4

Re: Image Verification - 1.0.3

Could this be a basis for a captcha image for guest posting?

5 (edited by Ataxy 2005-03-20 17:23)

Re: Image Verification - 1.0.3

ok i installed it and i got a similar error to the one for the box mod

Notice: Undefined index: o_regs_verify_image in /home/vhost/d-vault.peerforces.com/html/forum/register.php on line 289

edit: oh by the way this error appears in registration form in between the password box and the email box i guess where the image verification should appear

Re: Image Verification - 1.0.3

Should be fixed as of 1.0.2, just run the install_mod.php from new download.

I enjoy pie :)

7

Re: Image Verification - 1.0.3

no i am still getting this error

Undefined index: o_regs_verify_image in /home/vhost/d-vault.peerforces.com/html/forum/register.php on line 289

Re: Image Verification - 1.0.3

Could you download and run the install mod again and inform me if that fixes

I enjoy pie :)

Re: Image Verification - 1.0.3

1.0.3 should fix install_mod.php problems, and include the file that my silly self left out of bundle (font)

I enjoy pie :)

10

Re: Image Verification - 1.0.3

lol it did got rid of the error but actualy there is no change to the registring form now i see no image in between the password box and the email but i do not have any error message

11

Re: Image Verification - 1.0.3

ok sorry got it forgot to activate the option but i get no image in the image verification box

Re: Image Verification - 1.0.3

Be sure you uploaded the gdf file from the new version.

I enjoy pie :)

13

Re: Image Verification - 1.0.3

yes i did to the root folder

Re: Image Verification - 1.0.3

In that case you probably do not have GD enabled, check your phpinfo

I enjoy pie :)

15

Re: Image Verification - 1.0.3

do you have any idea in the phpinfo where it should be should i find that in the php core

Re: Image Verification - 1.0.3

Just search for "GD" it should come up, if nothing comes up you don't have it enabled

I enjoy pie :)

17

Re: Image Verification - 1.0.3

oh well seems i dont have it ... oh well at least i helped you fix some box ....ok next mod then i guess...lol

Re: Image Verification - 1.0.3

There are instructions to enable GD in the topic post for this thread, if you do not have access you can try requesting from your administrators

I enjoy pie :)

19

Re: Image Verification - 1.0.3

ok thx

Re: Image Verification - 1.0.3

I noticed that if I don't enter the text during registration, I get an error pop up saying "Undefined is a required field". Shouldn't it say something like.."Image text is a required field"?

Re: Image Verification - 1.0.3

Yes it should, I'll release a new version sometime soon, thanks

I enjoy pie :)

22 (edited by Dexus 2005-07-29 11:54)

Re: Image Verification - 1.0.3

I have played with generator itself, and have stopped at this version.
Blurred and deformed B/W letters.
Better to use something like "Times" font.
http://inatix.com/forum/ran.php

    function createImage($width=160,$height=40,$len=8)
    {
        // send header for our image
        header("Content-type:image/jpeg");

        // generate a random string
        $alphanum = array(
            "A", "B", "C", "D", "E", "F", "G",
            "H", "K", "L", "M", "P", "R",
            "T", "U", "V", "X", "Y",
            "2", "3", "4", "6", "7", "8", "9");
        $string = array_rand($alphanum, $len);

        // create an image 
        $im3=imagecreatetruecolor($width,$height);
        $cee=30;
        $cee2=$cee/2;
        $width+=$cee;
        $height+=$cee;
        $im=imagecreatetruecolor($width,$height);
        $im2=imagecreatetruecolor($width,$height);

        $bck = ImageColorAllocate ($im, 240,240,240);
        $bck2 = ImageColorAllocate ($im, 10,10,10);


        ImageFill($im, 0, 0, $bck); 

        $font = "fonttt3.ttf";
        $str="";

        for($i=0;$i<$len;$i++) {
            $ss=rand(16,20);
            $a=rand(-30, 30);
            $b=sin(deg2rad($a+45))*9;
            $c=cos(deg2rad($a+45))*9;
            $x1=($i)*19+13+$cee2;
            $y1=rand(20,30)+$cee2;
            imagettftext($im,
            $ss,
            $a,
            $x1-$c,
            $y1+$b,
            $bck2,
            $font,
            $alphanum[$string[$i]]);
            $str.=$alphanum[$string[$i]];

            for ($j=0;$j<40;$j++){
                $xx=$x1+rand(-12,12);
                $yy=$y1+rand(-16,12);
                if ($xx>=$width||$yy>=$height||$xx<0||$yy<0) continue;
                ImageSetPixel($im, $xx, $yy, $bck2);
            }


        }
        for ($i=0;$i<25;$i++)
        {
            $xl=rand(70,$width-3);
            $yl=rand(30,$height-3);
            $x1=rand(2,$width-$xl-2);
            $y1=rand(2,$height-$yl-2);
            imagecopy($im2,$im,0,0,0,0,$width,$height);
            imagecopymerge ($im, $im2, $x1, $y1, $x1+$i%3-1, $y1+($i+2)%2-1, $xl, $yl,90);
        }
        imagecopy($im3,$im,0,0,$cee2,$cee2+$cee2/3*2,$width-$cee,$height-$cee);


        imagejpeg($im3);
        // destroy images
        imagedestroy($im);
        imagedestroy($im2);
        imagedestroy($im3);

        // return the random text generated
        return $this->text=$str;
    }

Re: Image Verification - 1.0.3

Dexus:  Your code doesn't work for me.  I'm guessing it's because I don't have the fonttt3.ttf file.  Where do I get it, and where do I put it?

Thanks

24 (edited by Dexus 2005-07-29 14:53)

Re: Image Verification - 1.0.3

someguy, any ttf font file will work. you can rename file or change font filename in script.
as I said, i recommend a sort of Times font.
you cen search a sites of free ttf fonts in a web. there are lot of them, for example http://www.fontpool.com
or you can take a ttf file from windows/fonts folder (but I dont know what about legal part)
put it in folder with your ran.php script.

it's not a stand-alone script, it's just a alternative image generation function for Mediator's script (thanks a lot! smile )
if you want it, you have to replace original one with it. and also provide it with font file (in a same folder).

Addition: maybe you'll find it too deformed.. if so - just play with "blurring" coefficient (90%) in
imagecopymerge ($im, $im2, $x1, $y1, $x1+$i%3-1, $y1+($i+2)%2-1, $xl, $yl, /**/90/**/);
or deformation range (25) in
for ($i=0;$i</**/25/**/;$i++)
or "dirty points" quantity (40) in
for ($j=0;$j</**/40/**/;$j++){

good luck

Re: Image Verification - 1.0.3

Thanks for the help.  It's working now.