phpcaptcha.org 캡차 라이브러리 적용 삽질 이야기
마스터욱
0
25
0
0
2017-06-11 22:55:13
캡차 input 생성
- <?php
- require_once './securimage/securimage.php';
- $options['input_name'] = 'captcha_code'; // change name of input element for form post
- // error html to show in captcha output
- $options['error_html'] = $_SESSION['ctform']['captcha_error'];
- }
- //print_r2($_SESSION);
- //echo Securimage::getCaptchaHtml($options);
- ?>
캡차 인증
- include_once './securimage/securimage.php';
- $securimage = new Securimage();
- if($securimage->check($_POST['captcha_code']) == false) {
- echo "인증실패";
- exit;
- }
위처럼 처리하면 된다.
하지만 첫 시도때는 위처럼 적용해도 되지 않았다...
문제는 내 프로그램 소스상의 아래 문제 때문이었다.
session_save_path(PATH_SESSION);
세션경로를 강제로 잡아버리면 캡차가 세션을 굽지 못했다.
명색히 오픈소스 라는게 세션path 를 변경했다는 이유만으로 안된다니...
아니면 보안상 다른 문제라도 있어서 그런건가?
이참에 나도 세션path 를 해지하기는 했다만...
이걸로 1시간 넘게 삽질했는데, 이걸로 고민하는 사람들이 없기를 바라며~