Results 1 to 4 of 4

Thread: image verification

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    265

    image verification

    hello everybody
    I found a code for making a verification image, but the problem that the image produced is so simple so anybody can use a program to analyize it and figure out the characters so it is not save(then they can use programs to generates new account automatically)
    So, what I want is to complicate the image produced. I want the image the one which we can see when we search in google by using proxys.
    Here is The Code:
    Code:
    <?php
     /*header*/
    Header("Content-Type: image/png");
    
    /* initialize a session. */
    session_start();
    
    /*We'll set this variable later.*/
    $new_string;
    
    /*register the session variable. */
    session_register('new_string');
    
    /*You will need these two lines below.*/
    echo "<html><head><title>Verification</title></head>";
    echo "<body>";
    /* set up image, the first number is the width and the second is the height*/
    $im = ImageCreate(200, 40); 
    
    /*creates two variables to store color*/
    $white = ImageColorAllocate($im, 255, 255, 255);
    $black = ImageColorAllocate($im, 0, 0, 0);
    
    /*random string generator.*/
    /*The seed for the random number*/
    srand((double)microtime()*1000000); 
    
    /*Runs the string through the md5 function*/
    $string = md5(rand(0,9999)); 
    
    /*creates the new string. */
    $new_string = substr($string, 17, 5);
    
     /*fill image with black*/
    ImageFill($im, 0, 0, $black);
    
     /*writes string */
    ImageString($im, 4, 96, 19, $new_string, $white);
    
    /* output to browser*/
    ImagePNG($im, "verify.png");
    ImageDestroy($im);
    
    echo "<img src=\"verify.png\">";
    echo "<br><br>";
    echo "Type the code you see in the image in the box below. (case sensitive)";
    echo " <form action=\"formhandler.php\" method=post>";
    echo "<input name=\"random\" type=\"text\" value=\"\">";
    echo "<input type=\"submit\">";
    echo "</form>";
    echo "</body>";
    echo "</html>";
    ?>
    Thank's alot

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: image verification

    you could use a third party app like re-captcha

    edit:

    a quick google search gave me this:
    http://www.white-hat-web-design.co.u...hp-captcha.php
    Last edited by dclamp; Jun 26th, 2008 at 12:55 AM.
    My usual boring signature: Something

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    265

    Re: image verification

    Thx alot bro
    yes it is much complicated & works fine. I hope it is safe enough!
    Thx

  4. #4
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: image verification

    you are welcome!
    My usual boring signature: Something

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width