load->helper(array('captcha', 'string')); } /** * 캡차 세션 생성후 보여주는 함수입니다. */ function show($width = '', $height = '') { $this->output->set_content_type('application/json'); if ( ! $width) { $width = 150; } if ( ! $height) { $height = 40; } $img_path = config_item('uploads_dir') . '/captcha/'; if ( ! is_dir($img_path)) { @mkdir($img_path, 0755); @chmod($img_path, 0755); $file = $img_path . 'index.php'; $f = @fopen($file, 'w'); @fwrite($f, ''); @fclose($f); @chmod($file, 0644); } $data = array( 'img_path' => $img_path, 'img_url' => site_url(config_item('uploads_dir') . '/captcha') . '/', 'img_width' => $width, 'img_height' => $height, 'font_size' => 15, 'font_path' => './assets/fonts/BreeSerif-Regular.ttf', 'pool' => '23456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ', 'word_length' => '8', 'img_id' => 'captcha', ); $cap = create_captcha($data); $save = array( 'captcha_time' => $cap['time'], 'ip_address' => $this->input->ip_address(), 'word' => $cap['word'], ); $this->session->set_userdata('captcha', $save); exit(json_encode($cap)); } /** * 구글 캡차 생성후 보여주는 함수입니다. */ function recaptcha() { $html = '
'; $html .= ''; $html .= '
'; $html .= ''; echo $html; } }