Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Captcha{
- public function generate_captcha()
- {
- $this->load->helper('captcha');
- $random_number = substr(number_format(time() * rand(),0,'',''),0,6);
- $config = array(
- 'word' => $random_number,
- 'img_path' => './files/captcha/',
- 'img_url' => base_url().'files/captcha/',
- 'img_width' => 200,
- 'img_height' => 60,
- 'font_path' => './assets/fonts/burnstown_dam.ttf',//silahkan download sendiri jenis font yang anda sukai
- 'font_size' => 26,
- 'expiration' => 7200
- );
- $captcha = create_captcha($config);
- $this->session->set_userdata('captcha',$captcha["word"]);
- return $captcha;
- }
- public function __get($key)
- {
- return get_instance()->$key;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement