Exemple #1
0
 /**
  * Проверочный код
  */
 public function captcha()
 {
     header('Content-type: image/jpeg');
     $phrase = new Gregwar\Captcha\PhraseBuilder();
     $phrase = $phrase->build(5, '0123456789');
     $builder = new Gregwar\Captcha\CaptchaBuilder($phrase);
     $builder->setBackgroundColor(mt_rand(220, 255), mt_rand(220, 255), mt_rand(220, 255));
     $builder->setDistortion(false)->build()->output();
     $_SESSION['captcha'] = $builder->getPhrase();
 }
Exemple #2
0
 public function index()
 {
     $builder = new Gregwar\Captcha\CaptchaBuilder();
     $builder->setDistortion(false);
     $builder->build();
     $this->session->set_userdata('captcha', $builder->getPhrase());
     $registrant = [];
     if (empty($this->session->flashdata('data')) === false) {
         $registrant = $this->session->flashdata('data');
     }
     $this->load->view('login/index', ['builder' => $builder, 'registrant' => $registrant]);
 }