SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Arrow what is the problem with this? captcha?

    hi guys

    i'm trying to analyze an existing codes created by another programmer,

    Code:
    <?php
    session_start();
    
    $RandomStr = md5(microtime());// md5 to generate the random string
    
    $ResultStr = substr($RandomStr,0,5);//trim 5 digit 
    
    $NewImage = imagecreatefromjpeg("images/bggreys.jpg");//image create by existing image and as back ground 
                
    //$LineColor = imagecolorallocate($NewImage,233,239,239);//line color 
    $TextColor = imagecolorallocate($NewImage, 255, 255, 255);//text color-white
    
    //imageline($NewImage,1,1,40,40,$LineColor);//create line 1 on image 
    //imageline($NewImage,1,100,60,0,$LineColor);//create line 2 on image 
    
    imagestring($NewImage, 7, 30, 3, $ResultStr, $TextColor);// Draw a random string horizontally 
    
    $_SESSION['key'] = $ResultStr;// carry the data through session
    
    header("Content-type: image/jpeg");// out out the image 
    
    imagejpeg($NewImage);//Output image to browser 
    
    ?>
    It's trying to create a captcha.

    But unfurtunately it's not working...

    Any help to fix this codes running properly please.

    Thank you in advance.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    When you post php code, please use the php code tags. It makes for an easier read
    Quote Originally Posted by solidcodes View Post
    But unfurtunately it's not working...
    What does that mean?

  3. #3
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    By the way i noticed some of the built in php functions don't work in the site.

    example of function is imagecreate() this is built in php but i don't work, see below,
    http://onstaged.com/ztest/captcha3.php

    why is this?

    thanks in advance.

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Your PHP installation does not have the GD library installed.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


Bookmarks

Posting Permissions

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