Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. public function index()
  2. {
  3. $config['image_library'] = 'gd2';
  4. $this->load->library('image_lib', $config);
  5. $vals = array(
  6. 'img_path' => './captcha/',
  7. 'img_url' => base_url().'public/img/captcha/',
  8. 'img_width' => '200',
  9. 'img_height' => 30,
  10. 'border' => 0,
  11. 'expiration' => 7200,
  12. );
  13.  
  14. // create captcha image
  15. $cap = create_captcha($vals);
  16. print_r($cap);
  17. // store image html code in a variable
  18. $arrData['image'] = $cap['image'];
  19.  
  20. // store the captcha word in a session
  21. $this->session->set_userdata('word', $cap['word']);
  22. $arrData['middle'] = 'contact';
  23. $this->load->view('template',$arrData);
  24. }
  25.  
  26. <div class="enquiry-deatils">
  27. <label>Type character * :</label>
  28. <input type="text" placeholder="" class="captcha"/>
  29. <label><img src="images/capcha.jpg" /></label>
  30. <?php echo $image; // this will show the captcha image ?>
  31. </div>
  32.  
  33. $vals = array(
  34. 'img_path' => 'mysite/public/img/captcha/',
  35. 'img_url' => 'mysite/public/img/captcha/',
  36. 'img_width' => '150',
  37. 'img_height' => 30,
  38. 'expiration' => 7200,
  39. "time" => time()
  40. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement