Advertisement
margokdb

capca_c

May 18th, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class registrasi extends CI_Controller {
  4.    
  5.     public function index()
  6.     {
  7.         // load the session library
  8.         $this->load->library('session');
  9.         $this->load->helper(array('captcha','url'));
  10.  
  11.         // if form was submitted and given captcha word matches one in session
  12.         if ($this->input->post() && ($this->input->post('secutity_code') == $this->session->userdata('mycaptcha'))) {
  13.             $this->load->view('berhasil.php');
  14.         }
  15.         else
  16.         {
  17.             // load codeigniter captcha helper
  18.             $this->load->helper('captcha');
  19.  
  20.             $vals = array(
  21.                 'img_path'   => './captcha/',
  22.                 'img_url'    => base_url().'captcha/',
  23.                 'img_width'  => '200',
  24.                 'img_height' => 30,
  25.                 'border' => 0,
  26.                 'expiration' => 7200
  27.             );
  28.  
  29.             // create captcha image
  30.             $cap = create_captcha($vals);
  31.  
  32.             // store image html code in a variable
  33.             $data['image'] = $cap['image'];
  34.  
  35.             // store the captcha word in a session
  36.             $this->session->set_userdata('mycaptcha', $cap['word']);
  37.  
  38.             $this->load->view('registrasi_view.php', $data);
  39.  
  40.         }
  41.     }
  42. }
  43.  
  44. /* End of file registrasi.php */
  45. /* Location: ./application/controllers/registrasi.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement