AvocadoAmber/AvocadoEdition_Light/plugin/kcaptcha/kcaptcha_session.php

24 lines
695 B
PHP
Raw Normal View History

2024-09-23 11:07:19 +09:00
<?php
2024-09-26 08:55:13 +09:00
include_once "_common.php";
include_once dirname(__FILE__) . "/kcaptcha_config.php";
2024-09-26 08:55:13 +09:00
include_once "captcha.lib.php";
2024-09-23 11:07:19 +09:00
while (true) {
$keystring = '';
for ($i = 0; $i < $length; $i++) {
$keystring .= $allowed_symbols[mt_rand(0, strlen($allowed_symbols) - 1)];
}
if (!preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $keystring))
break;
2024-09-23 11:07:19 +09:00
}
if ($keystring && function_exists('get_string_encrypt')) {
$ip = md5(sha1($_SERVER['REMOTE_ADDR']));
$keystring = get_string_encrypt($ip . $keystring);
2024-09-23 11:07:19 +09:00
}
set_session("ss_captcha_count", 0);
set_session("ss_captcha_key", $keystring);
$captcha = new KCAPTCHA();
2024-09-26 08:55:13 +09:00
$captcha->setKeyString(get_session("ss_captcha_key"));