센스리더 오류? 해결을 위하여 캡챠 wav 파일에 다운로드 제공, 그러나 결과는 좋지 않음
This commit is contained in:
35
bbs/gcaptcha/down.php
Normal file
35
bbs/gcaptcha/down.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?
|
||||
include_once('./_common.php');
|
||||
|
||||
$file = addslashes($_GET['file']);
|
||||
$captcha_path = mk_subdir($g4['cache_dir'].'/'.$g4['captcha_dir']);
|
||||
$filepath = $captcha_path.'/'.$file;
|
||||
$original = "number.wav";
|
||||
|
||||
if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||
header("content-type: doesn/matter");
|
||||
header("content-length: ".filesize("$filepath"));
|
||||
header("content-disposition: attachment; filename=\"$original\"");
|
||||
header("content-transfer-encoding: binary");
|
||||
} else {
|
||||
header("content-type: file/unknown");
|
||||
header("content-length: ".filesize("$filepath"));
|
||||
header("content-disposition: attachment; filename=\"$original\"");
|
||||
header("content-description: php generated data");
|
||||
}
|
||||
header("pragma: no-cache");
|
||||
header("expires: 0");
|
||||
flush();
|
||||
|
||||
$fp = fopen($filepath, 'rb');
|
||||
|
||||
$download_rate = 10;
|
||||
|
||||
while(!feof($fp)) {
|
||||
print fread($fp, round($download_rate * 1024));
|
||||
flush();
|
||||
usleep(1000);
|
||||
}
|
||||
fclose ($fp);
|
||||
flush();
|
||||
?>
|
||||
@ -151,6 +151,7 @@ function captcha_html($class="captcha")
|
||||
$html .= '<legend class="sound_only">스팸방지</legend>';
|
||||
$html .= '<img src="'.captcha_file('.png').'" alt="스팸방지 숫자">';
|
||||
$html .= '<a href="'.captcha_file('.wav').'" id="captcha_wav"><img src="'.$g4['bbs_path'].'/gcaptcha/img/sound.gif" alt="숫자를 음성으로 듣기"></a>';
|
||||
$html .= '<a href="'.$g4['gcaptcha_path'].'/down.php?file='.abs_ip2long().'_'.$_COOKIE['PHPSESSID'].'.wav'.'" id="captcha_wav">다운로드</a>';
|
||||
$html .= '<input type="text" id="captcha_key" name="captcha_key" class="captcha_box fieldset_input" size="6" maxlength="6" required title="스팸방지 숫자 입력">';
|
||||
$html .= '<p class="sound_only">스팸방지 숫자를 순서대로 입력하세요.</p>';
|
||||
$html .= '</fieldset>';
|
||||
|
||||
Reference in New Issue
Block a user