game/support/captcha.class.php
2023-01-10 18:30:35 +02:00

36 lines
746 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
Class Captcha{
public $imgDir = 'images'; // директория где хранятся изображения
public $length = '5'; // количество цифр в капче
public function __construct(){
$this->keystring=array();
for($i=0;$i < $this->length;$i++){
$this->keystring[] .= mt_rand(0,9);
}
}
public function draw(){
$img = '';
foreach($this->keystring as $keystring){
$img .= '<img src="'.$this->imgDir.DIRECTORY_SEPARATOR.$keystring.'.gif" border="0">';
}
return $img;
}
public function getKeyString(){
return implode($this->keystring);
}
}
?>