Вход Регистрация
Файл: upload/catalog/controller/captcha/basic_captcha.php
Строк: 52
<?php
class ControllerCaptchaBasicCaptcha extends Controller {
    public function 
index($error = array()) {
        
$this->load->language('captcha/basic_captcha');

        
$data['heading_title'] = $this->language->get('heading_title');

        
$data['entry_captcha'] = $this->language->get('entry_captcha');

        if (isset(
$error['captcha'])) {
            
$data['error_captcha'] = $error['captcha'];
        } else {
            
$data['error_captcha'] = '';
        }

        
$data['route'] = $this->request->get['route']; 

        if (
file_exists(DIR_TEMPLATE $this->config->get('config_template') . '/template/captcha/basic_captcha.tpl')) {
            return 
$this->load->view($this->config->get('config_template') . '/template/captcha/basic_captcha.tpl'$data);
        } else {
            return 
$this->load->view('default/template/captcha/basic_captcha.tpl'$data);
        }
    }

    public function 
validate() {
        
$this->load->language('captcha/basic_captcha');

        if (empty(
$this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) {
            return 
$this->language->get('error_captcha');
        }
    }

    public function 
captcha() {
        
$this->session->data['captcha'] = substr(sha1(mt_rand()), 176);

        
$image imagecreatetruecolor(15035);

        
$width imagesx($image);
        
$height imagesy($image);

        
$black imagecolorallocate($image000);
        
$white imagecolorallocate($image255255255);
        
$red imagecolorallocatealpha($image2550075);
        
$green imagecolorallocatealpha($image0255075);
        
$blue imagecolorallocatealpha($image0025575);

        
imagefilledrectangle($image00$width$height$white);
        
imagefilledellipse($imageceil(rand(5145)), ceil(rand(035)), 3030$red);
        
imagefilledellipse($imageceil(rand(5145)), ceil(rand(035)), 3030$green);
        
imagefilledellipse($imageceil(rand(5145)), ceil(rand(035)), 3030$blue);
        
imagefilledrectangle($image00$width0$black);
        
imagefilledrectangle($image$width 10$width 1$height 1$black);
        
imagefilledrectangle($image000$height 1$black);
        
imagefilledrectangle($image0$height 1$width$height 1$black);

        
imagestring($image10intval(($width - (strlen($this->session->data['captcha']) * 9)) / 2), intval(($height 15) / 2), $this->session->data['captcha'], $black);

        
header('Content-type: image/jpeg');

        
imagejpeg($image);

        
imagedestroy($image);
    }
}
Онлайн: 2
Реклама