Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function index()
- {
- $config['image_library'] = 'gd2';
- $this->load->library('image_lib', $config);
- $vals = array(
- 'img_path' => './captcha/',
- 'img_url' => base_url().'public/img/captcha/',
- 'img_width' => '200',
- 'img_height' => 30,
- 'border' => 0,
- 'expiration' => 7200,
- );
- // create captcha image
- $cap = create_captcha($vals);
- print_r($cap);
- // store image html code in a variable
- $arrData['image'] = $cap['image'];
- // store the captcha word in a session
- $this->session->set_userdata('word', $cap['word']);
- $arrData['middle'] = 'contact';
- $this->load->view('template',$arrData);
- }
- <div class="enquiry-deatils">
- <label>Type character * :</label>
- <input type="text" placeholder="" class="captcha"/>
- <label><img src="images/capcha.jpg" /></label>
- <?php echo $image; // this will show the captcha image ?>
- </div>
- $vals = array(
- 'img_path' => 'mysite/public/img/captcha/',
- 'img_url' => 'mysite/public/img/captcha/',
- 'img_width' => '150',
- 'img_height' => 30,
- 'expiration' => 7200,
- "time" => time()
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement