PHP Classes

captcha.class.php error

Recommend this page to a friend!

      CAPTCHA 2  >  All threads  >  captcha.class.php error  >  (Un) Subscribe thread alerts  
Subject:captcha.class.php error
Summary:error in class method call
Messages:5
Author:phpWalter
Date:2007-02-28 05:39:09
Update:2007-03-14 02:57:30
 

  1. captcha.class.php error   Reply   Report abuse  
Picture of phpWalter phpWalter - 2007-02-28 05:39:09
line 259

$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_DEV_RANDOM)

The last parameter does not work on my system:
* XP Pro SP2
* Apache 2.x
* PHP 5.x

I had to change it to:

$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);

Hope this helps someone else.

  2. Re: captcha.class.php error   Reply   Report abuse  
Picture of Cristian Navalici Cristian Navalici - 2007-02-28 06:10:12 - In reply to message 1 from phpWalter
Yes, you are right.

"The source can be MCRYPT_RAND (system random number generator), MCRYPT_DEV_RANDOM (read data from /dev/random) and MCRYPT_DEV_URANDOM (read data from /dev/urandom). MCRYPT_RAND is the only one supported on Windows because Windows (of course) doesn't have /dev/random or /dev/urandom."

So for Windows, must use only MCRYPT_RAND.
I will add this comment to class.

Thank you!

  3. Re: captcha.class.php error   Reply   Report abuse  
Picture of phpWalter phpWalter - 2007-03-12 21:53:39 - In reply to message 2 from Cristian Navalici
Thanks for the "fix", but...

Now I get this error...

Notice: Undefined property: Captcha::$use_windows

I don't see where this var class property is defined...

$this->use_windows

????

Walter

  4. Re: captcha.class.php error   Reply   Report abuse  
Picture of Cristian Navalici Cristian Navalici - 2007-03-13 20:00:17 - In reply to message 3 from phpWalter
For some strange reason, the file on phpclasses was not updated.
Now, it's ok.

This was the missing line:

private $use_windows = 0; // 1 - if you'll use windows 0 - if don't
// until here

Thanks for your message.

  5. Re: captcha.class.php error   Reply   Report abuse  
Picture of phpWalter phpWalter - 2007-03-14 02:57:30 - In reply to message 4 from Cristian Navalici
Thanks for that "fix", but may I suggest instead...

line 45: (move it from line 40)
private $use_windows = false;

line 53:

// See if this is a WINDOWS box, or not
$this->use_windows();

line 165: (line 162 if you didn't insert above lines)

//======================================================================
// USE WINDOWS
// function to determine if server is Windows box, or not
//
// @arg: none
// @return: none
//======================================================================
private function use_windows() {
if ( isset($_SERVER['WINDIR']) )
$this->use_windows = true;
}

 
For more information send a message to info at phpclasses dot org.