🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #230794

captcha przestało mi działać

#230794
From: jivanmukta
Date: Tue, 02 Dec 2014 18:45
76 lines
3305 bytes
Przestała mi działać captcha, mimo że kodu nie zmieniałem.
Wyświetlam ją tak:
Kontroler zawiera:

private function loadAnnouncementView(array $params) {
    $params['captcha'] = $this->mycaptcha->deleteImage()->createWord()->createCaptcha();
    $this->load->view('announcement/form', $params);
}

Widok zawiera:
    <p>
        <?php echo $captcha; ?> 
        Wpisz napis widoczny na obrazku: 
        <input type="text" name="captcha" maxlength="8" size="8" style="width: 8ex">
        <?php echo myFormError('captcha'); ?>
    </p>

libraries/mycaptcha.php ma treść:

<?php 
if (!defined('BASEPATH')) exit('No direct script access allowed');

class Mycaptcha {

public $word = '';
public $ci = ''; 

public function __construct() {    
    $ci =& get_instance();
    $ci->load->helper('captcha');
    $this->ci = $ci; 
}

public function createWord() {
    $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $word = '';
    for ($a = 0; $a <= 5; $a++) {
        $b = rand(0, strlen($chars) - 1);
        $word .= $chars[$b];
    }        
    $this->word = $word;
    return $this; 
}

public function createCaptcha() {
    $cap = array(
        'word' => $this->word,
        'img_path' => './captcha/',
        'img_url' => base_url() . 'captcha/',
        'img_width' => '150',
        'img_height' => '30',
        'expiration' => '7200'
    );
    $captchaOutput = create_captcha($cap); 
    $this->ci->session->set_userdata(array('word' => $this->word, 'image' => $captchaOutput['time'] . '.jpg')); //set data to session for compare 
    return $captchaOutput['image']; 
}

public function deleteImage() {
    $image = $this->ci->session->userdata('image');
    if (!empty($image)) {
        $lastImage = FCPATH . 'captcha/' . $image;
        if (file_exists($lastImage)) {
            unlink($lastImage);
        }    
    }
    return $this;
}
}

Problem polega na tym,ze w wierszu 
    $captchaOutput = create_captcha($cap); 
funkcja create_captcha zwraca FALSE.
Katalog public_html/captcha ma atrybuty:
  drwxrwxr-x robert robert 4096 gru 2 19:24
Proszę o pomoc.
Technical Details
Message-ID: <377d856f-be30-4b20-80ae-bdea73b22e88@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.glorb.com!w8no4170109qac.0!news-out.google.com!m4ni588qag.1!nntp.google.com!s7no3676378qap.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Received: by 10.236.38.36 with SMTP id z24mr704414yha.8.1417545942812;        Tue, 02 Dec 2014 10:45:42 -0800 (PST)
X-Received: by 10.140.100.201 with SMTP id s67mr13256qge.34.1417545942792; Tue, 02 Dec 2014 10:45:42 -0800 (PST)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.glorb.com!w8no4170109qac.0!news-out.google.com!m4ni588qag.1!nntp.google.com!s7no3676378qap.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.php
Date: Tue, 2 Dec 2014 10:45:42 -0800 (PST)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=89.73.80.243; posting-account=Fd8BNwoAAACl8PCi6-fI0bkHGOgt6LMa
NNTP-Posting-Host: 89.73.80.243
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <377d856f-be30-4b20-80ae-bdea73b22e88@googlegroups.com>
Subject: captcha przestało mi działać
From: jivanmukta@poczta.onet.pl
Injection-Date: Tue, 02 Dec 2014 18:45:42 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit