Advertisement
juliarnasution

Captcha.php

Dec 4th, 2019
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. class Captcha{
  3.     public function generate_captcha()
  4.     {
  5.         $this->load->helper('captcha');
  6.         $random_number = substr(number_format(time() * rand(),0,'',''),0,6);
  7.         $config = array(
  8.             'word' => $random_number,
  9.             'img_path' => './files/captcha/',
  10.             'img_url' => base_url().'files/captcha/',
  11.             'img_width' => 200,
  12.             'img_height' => 60,
  13.             'font_path'  => './assets/fonts/burnstown_dam.ttf',//silahkan download sendiri jenis font yang anda sukai
  14.             'font_size' => 26,
  15.             'expiration' => 7200
  16.         );
  17.         $captcha = create_captcha($config);
  18.         $this->session->set_userdata('captcha',$captcha["word"]);
  19.         return $captcha;
  20.     }
  21.    
  22.     public function __get($key)
  23.     {
  24.         return get_instance()->$key;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement