Файл: DCMS/captcha.class.php
Строк: 21
<?php 
#################################
#     СКРИПТ ОБРАТНОЙ СВЯЗИ     #
# Автор: PHPSID                 #
# Дата: 15.07.2011              #
# icq: 44442111                 #
# Сайт: http://rusban.su        #
#################################
Class Captcha{
    
    public $imgDir = 'images'; // директория где хранятся изображения
    
    public $length = '3'; // количество цифр в капче
    
    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" alt="" width="20" height="20"/>';
        }
        
        return $img;
    }
    
    
    public function getKeyString(){
        return implode($this->keystring);
    }
    
}
?>