/** * Save user's captcha configuration options. * * @param array $config * @return void */ public static function save(array $config) { unset($config['CaptchaId']); unset($config['UserInputID']); if (empty($config)) { return; } $settings = \CaptchaConfiguration::LoadSettings(); foreach ($config as $option => $value) { $settings->{$option} = $value; } \CaptchaConfiguration::SaveSettings($settings); }
<?php $baseUrl = \LaravelCaptcha\Support\LaravelInformation::getBaseUrl(); $BotDetect = \CaptchaConfiguration::GetSettings(); $BotDetect->HandlerUrl = $baseUrl . '/captcha-handler'; // use Laravel session to store persist Captcha codes and other Captcha data $BotDetect->SaveFunctionName = 'LA_Session_Save'; $BotDetect->LoadFunctionName = 'LA_Session_Load'; $BotDetect->ClearFunctionName = 'LA_Session_Clear'; \CaptchaConfiguration::SaveSettings($BotDetect); // re-define custom session handler functions function LA_Session_Save($key, $value) { // save the given value with the given string key \Session::put($key, serialize($value)); } function LA_Session_Load($key) { // load persisted value for the given string key if (\Session::has($key)) { return unserialize(\Session::get($key)); // NOTE: returns false in case of failure } } function LA_Session_Clear($key) { // clear persisted value for the given string key if (\Session::has($key)) { \Session::remove($key); } }
$LBD_CaptchaConfig->ReloadTooltip = 'Change the CAPTCHA code'; $LBD_CaptchaConfig->AutoReloadExpiredCaptchas = true; $LBD_CaptchaConfig->AutoReloadTimeout = 7200; // Captcha help link configuration // --------------------------------------------------------------------------- $LBD_CaptchaConfig->HelpLinkEnabled = true; $LBD_CaptchaConfig->HelpLinkMode = HelpLinkMode::Text; $LBD_CaptchaConfig->HelpLinkUrl = ''; $LBD_CaptchaConfig->HelpLinkText = ''; // Captcha user input configuration // --------------------------------------------------------------------------- $LBD_CaptchaConfig->AutoFocusInput = true; $LBD_CaptchaConfig->AutoClearInput = true; $LBD_CaptchaConfig->AutoUppercaseInput = true; // Captcha remote script configuration // --------------------------------------------------------------------------- $LBD_CaptchaConfig->RemoteScriptEnabled = true; // Captcha URL configuration // --------------------------------------------------------------------------- $LBD_CaptchaConfig->HandlerUrl = 'botdetect.php'; $LBD_CaptchaConfig->ReloadIconUrl = LBD_URL_ROOT . 'lbd_reload_icon.gif'; $LBD_CaptchaConfig->SoundIconUrl = LBD_URL_ROOT . 'lbd_sound_icon.gif'; $LBD_CaptchaConfig->LayoutStylesheetUrl = LBD_URL_ROOT . 'lbd_layout.css'; $LBD_CaptchaConfig->ScriptIncludeUrl = LBD_URL_ROOT . 'lbd_scripts.js'; // Captcha persistence configuration // --------------------------------------------------------------------------- $LBD_CaptchaConfig->SaveFunctionName = 'PHP_Session_Save'; $LBD_CaptchaConfig->LoadFunctionName = 'PHP_Session_Load'; $LBD_CaptchaConfig->ClearFunctionName = 'PHP_Session_Clear'; CaptchaConfiguration::SaveSettings($LBD_CaptchaConfig);