Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12694 anikendra 1
<?php
2
if (!defined('BASEPATH'))
3
  exit('No direct script access allowed');
4
 
5
 
6
Class Captcha_model extends CI_Model {
7
 
8
  private $vals = array();
9
 
10
  // private $baseUrl  = base_url();
11
  // private $basePath = 'D:/apache2triad/htdocs/captchademo/';
12
 
13
  // private $captchaImagePath = 'tmp/captcha/';
14
  // private $captchaImageUrl  = 'tmp/captcha/';
15
  // private $captchaFontPath  = 'c:/windows/fonts/verdana.ttf';
16
 
17
  public function __construct($configVal = array())
18
  {
19
    parent::__construct();
20
 
21
    $this->load->helper('captcha');
22
 
23
    if(!empty($config))
24
      $this->initialize($configVal);
25
    else
26
      $this->vals = array(
27
                 'word'          => '',
28
                 'word_length'   => 5,
29
                 'img_path'      => './assets/captcha/',
30
                 'img_url'       => './assets/captcha/',
31
                 'font_path'     => './assets/fonts/Helvetica LT Extra Compressed.ttf',
32
                 'img_width'     => '300',
33
                 'img_height'    => '100',
34
                 'expiration'    => 3600
35
               );
36
  }
37
 
38
  /**
39
   * initializes the variables
40
   *
41
   * @author    Mohammad Jahedur Rahman
42
   * @access    public
43
   * @param     array     config
44
   */
45
  public function initialize ($configVal = array())
46
  {
47
    $this->vals = $configVal;
48
  } //end function initialize
49
 
50
  //---------------------------------------------------------------
51
 
52
  /**
53
   * generate the captcha
54
   *
55
   * @author     Mohammad Jahedur Rahman
56
   * @access     public
57
   * @return     array
58
   */
59
  public function generateCaptcha ()
60
  {
61
    $cap = create_captcha($this->vals);
62
 
63
    return $cap;
64
  } //end function generateCaptcha
65
}
66
?>