Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Location
    Australia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Security Captcha Help?

    Hi All,

    Can you please tell me why the security captcha does not show up?

    Website Address:

    http://www.sunit.site50.net/contact.html

    I tried the contact form and it does seem to be working other than the captcha.

    Here is the security_image.php code below.

    --------------------------------------------------------------

    <?php session_start();
    class captcha {
    var $font = 5;
    function random($nr) {
    $letters="23456789bcdfghjkmnpqrstvwxyz";
    while ($i < $nr) {
    if($i==rand(0,$nr-1)) {
    $text .= substr(strtoupper($letters), mt_rand(0, strlen($letters)-1), 1);
    }
    else
    {
    $text .= substr($letters, mt_rand(0, strlen($letters)-1), 1);
    }
    $i++;
    }
    return $text;
    }
    function captcha($width,$height,$nru) {
    $text=$this->random($nru);
    $image = @imagecreate($width, $height) or die('unable create image!');
    $bg_col = imagecolorallocate($image, 0, 191, 255);
    $txt_col = imagecolorallocate($image, 255, 255, 255);
    $rand_col = imagecolorallocate($image, 0, 0, 0);
    imagefill($image, 100, 100, $bg_col);
    imageantialias($image, true);
    imagestring($image, $this->font , rand(1, 10), rand(1,10), $text, $txt_col);
    imageline($image, rand(0,$width), rand(0,$height), rand(0,$width), rand(0,$height), $rand_col);
    for( $i=0; $i<6; $i++ ) {
    imagefilledellipse($image, rand(0,$width), rand(0,$height), 1, 1, $rand_col);
    }
    header('Content-Type: image/jpeg');
    imagejpeg($image);
    imagedestroy($image);
    $_SESSION['chapcha_code'] = strtolower($text);
    }
    }
    $width='70';
    $height='25';
    $nru='5';
    $iesire = new captcha($width,$height,$nru);
    ?>


    --------------------------------------------------------------------------------

    and the mailer.php code as well.

    --------------------------------------------------------------------------------


    <?php session_start();
    if(isset($_POST['Submit'])) { if( $_SESSION['chapcha_code'] == $_POST['chapcha_code'] && !empty($_SESSION['chapcha_code'] ) ) {
    $youremail = '';
    $fromsubject = '';
    $title = $_POST['title'];
    $fname = $_POST['fname'];
    $mail = $_POST['mail'];
    $address = $_POST['address'];
    $phone = $_POST['phone'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $to = $youremail;
    $mailsubject = 'Masage recived from'.$fromsubject.' Contact Page';
    $body = $fromsubject.'

    The person that contacted you is '.$fname.'
    Address: '.$address.'
    Phone Number: '.$phone.'
    E-mail: '.$mail.'
    Subject: '.$subject.'

    Message:
    '.$message.'

    |---------END MESSAGE----------|';
    echo "Thank you fo your feedback. I will contact you shortly if needed.<br/>Go to <a href='/index.php'>Home Page</a>";
    mail($to, $subject, $body);
    unset($_SESSION['chapcha_code']);
    } else {
    echo 'Sorry, you have provided an invalid security code';
    }
    } else {
    echo "You must write a message. </br> Please go to <a href='/contact.php'>Contact Page</a>";
    }
    ?>


    ------------------------------------------------------------------------------

    Thank you for any help you can offer.

    Newyork

  • #2
    Regular Coder
    Join Date
    May 2011
    Posts
    242
    Thanks
    1
    Thanked 57 Times in 56 Posts
    If you open http://www.sunit.site50.net/security_image.php you will see the error message "Fatal error: Call to undefined function imageantialias() in /home/a7892328/public_html/security_image.php on line 25".


  •  

    Tags for this Thread

    Posting Permissions

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