캡차파일 자동 삭제 코드 수정

This commit is contained in:
gnuboard
2013-10-21 11:59:32 +09:00
parent a451a124f6
commit 6d4ddc7ee3

View File

@ -3,7 +3,7 @@ include_once("_common.php");
function make_mp3() function make_mp3()
{ {
global $g4, $config; global $config;
$number = get_session("ss_captcha_key"); $number = get_session("ss_captcha_key");
@ -26,10 +26,10 @@ function make_mp3()
file_put_contents(G5_PATH.'/'.$mp3_file, $contents); file_put_contents(G5_PATH.'/'.$mp3_file, $contents);
// 지난 캡챠 파일 삭제 // 지난 캡챠 파일 삭제 (100번중에 한번만 실행)
if (rand(0,10) == 0) { if (rand(0,99) == 0) {
foreach (glob(G5_PATH.'/data/cache/kcaptcha-*.mp3') as $file) { foreach (glob(G5_PATH.'/data/cache/kcaptcha-*.mp3') as $file) {
if (filemtime($file) + 86400 < $g4['server_time']) { if (filemtime($file) + 86400 < G5_SERVER_TIME) {
unset($file); unset($file);
} }
} }