protected function create_random_value($length, $type = 'capchars') { if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits') && ($type != 'capchars')) { return false; } $rand_value = ''; while (strlen($rand_value) < $length) { if ($type == 'digits') { $char = mt_rand(0,9); } else { $char = chr(mt_rand(0,255)); } if ($type == 'mixed') { if (preg_match('/^[a-z0-9]$/i', $char)) { $rand_value .= $char; } } elseif ($type == 'chars') { if (preg_match('/^[a-z]$/i', $char)) { $rand_value .= $char; } } elseif ($type == 'digits') { if (preg_match('/^[0-9]$/', $char)) { $rand_value .= $char; } } elseif ($type == 'capchars') { if (preg_match('/^[A-Z]$/', $char)) { $rand_value .= $char; } } }
public $captchaType = 'capchars'; //chars, digits, mixed, capchars
public $captchaType = 'chars'; //chars, digits, mixed, capchars
protected function create_random_value($length, $type = 'capchars') { if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits') && ($type != 'capchars')) { return false; } $rand_value = ''; while (strlen($rand_value) < $length) { if ($type == 'digits') { $char = mt_rand(0,9); } else { $char = chr(mt_rand(0,255)); } if ($type == 'mixed') { if (preg_match('/^[0-9]$/i', $char)) { $rand_value .= $char; } } elseif ($type == 'chars') { if (preg_match('/^[0-9]$/i', $char)) { $rand_value .= $char; } } elseif ($type == 'digits') { if (preg_match('/^[0-9]$/', $char)) { $rand_value .= $char; } } elseif ($type == 'capchars') { if (preg_match('/^[0-9]$/', $char)) { $rand_value .= $char; } } } return $rand_value; }
Για δοκίμασε αυτό:captcha.class.php @line 53:Code: [Select]public $captchaType = 'capchars'; //chars, digits, mixed, capcharsσε Code: [Select]public $captchaType = 'chars'; //chars, digits, mixed, capchars
public $captchaType = 'digits'; //chars, digits, mixed, capchars
Καλά τώρα βλέπω την απάντηση που είχα δώσει και την ξανά κοιτάζω και την ξανά κοιτάζω και προσπαθώ να καταλάβω γιατί είχα γράψει chars αντί για digits.