当前位置: 首页>>代码示例>>PHP>>正文


PHP captcha::execute方法代码示例

本文整理汇总了PHP中captcha::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP captcha::execute方法的具体用法?PHP captcha::execute怎么用?PHP captcha::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在captcha的用法示例。


在下文中一共展示了captcha::execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

    function main($id, $mode)
    {
        global $db, $user, $phpbb_root_path, $config, $phpEx;
        // Do we have an id? No, then just exit
        $confirm_id = request_var('id', '');
        $type = request_var('type', 0);
        if (!$confirm_id || !$type) {
            exit;
        }
        // Try and grab code for this id and session
        $sql = 'SELECT code, seed
			FROM ' . CONFIRM_TABLE . "\n\t\t\tWHERE session_id = '" . $db->sql_escape($user->session_id) . "'\n\t\t\t\tAND confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\tAND confirm_type = {$type}";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        // If we have a row then grab data else create a new id
        if (!$row) {
            exit;
        }
        if ($config['captcha_gd']) {
            include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
        } else {
            include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
        }
        $captcha = new captcha();
        $captcha->execute($row['code'], $row['seed']);
        garbage_collection();
        exit_handler();
    }
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:29,代码来源:ucp_confirm.php

示例2: main

 function main($id, $mode)
 {
     global $db, $user, $auth, $template;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $user->add_lang('acp/board');
     $captcha_vars = array('captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS');
     if (isset($_GET['demo'])) {
         $captcha_vars = array_keys($captcha_vars);
         foreach ($captcha_vars as $captcha_var) {
             $config[$captcha_var] = isset($_REQUEST[$captcha_var]) ? request_var($captcha_var, 0) : $config[$captcha_var];
         }
         if ($config['captcha_gd']) {
             include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
         } else {
             include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
         }
         $captcha = new captcha();
         $captcha->execute(gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)), time());
         exit;
     }
     $config_vars = array('enable_confirm' => 'REG_ENABLE', 'enable_post_confirm' => 'POST_ENABLE', 'confirm_refresh' => 'CONFIRM_REFRESH', 'captcha_gd' => 'CAPTCHA_GD');
     $this->tpl_name = 'acp_captcha';
     $this->page_title = 'ACP_VC_SETTINGS';
     $form_key = 'acp_captcha';
     add_form_key($form_key);
     $submit = request_var('submit', '');
     if ($submit && check_form_key($form_key)) {
         $config_vars = array_keys($config_vars);
         foreach ($config_vars as $config_var) {
             set_config($config_var, request_var($config_var, ''));
         }
         $captcha_vars = array_keys($captcha_vars);
         foreach ($captcha_vars as $captcha_var) {
             $value = request_var($captcha_var, 0);
             if ($value >= 0) {
                 set_config($captcha_var, $value);
             }
         }
         add_log('admin', 'LOG_CONFIG_VISUAL');
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     } else {
         if ($submit) {
             trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
         } else {
             $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&demo=demo"));
             if (@extension_loaded('gd')) {
                 $template->assign_var('GD', true);
             }
             foreach ($config_vars as $config_var => $template_var) {
                 $template->assign_var($template_var, isset($_REQUEST[$config_var]) ? request_var($config_var, '') : $config[$config_var]);
             }
             foreach ($captcha_vars as $captcha_var => $template_var) {
                 $var = isset($_REQUEST[$captcha_var]) ? request_var($captcha_var, 0) : $config[$captcha_var];
                 $template->assign_var($template_var, $var);
                 $preview_image_src .= "&{$captcha_var}=" . $var;
             }
             $template->assign_vars(array('CAPTCHA_PREVIEW' => $preview_image_src, 'PREVIEW' => isset($_POST['preview'])));
         }
     }
 }
开发者ID:html,项目名称:PI,代码行数:60,代码来源:acp_captcha.php

示例3: execute

 function execute()
 {
     if (empty($this->code)) {
         if (!$this->load_code()) {
             // invalid request, bail out
             return false;
         }
     }
     $captcha = new captcha();
     define('IMAGE_OUTPUT', 1);
     $captcha->execute($this->code, $this->seed);
 }
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:12,代码来源:captcha_abstract.php

示例4: main

    function main($id, $mode)
    {
        global $db, $user, $phpbb_root_path, $config, $phpEx;
        // Do we have an id? No, then just exit
        $confirm_id = request_var('id', '');
        $type = request_var('type', 0);
        if (!$confirm_id || !$type) {
            exit;
        }
        // Try and grab code for this id and session
        $sql = 'SELECT code  
			FROM ' . CONFIRM_TABLE . " \n\t\t\tWHERE session_id = '" . $db->sql_escape($user->session_id) . "' \n\t\t\t\tAND confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\tAND confirm_type = {$type}";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        // If we have a row then grab data else create a new id
        if (!$row) {
            exit;
        }
        // Some people might want the olde style CAPTCHA even if they have GD enabled, this also saves us from people who have GD but no TTF
        $policy_modules = array('policy_entropy', 'policy_3dbitmap');
        if (function_exists('imagettfbbox') && function_exists('imagettftext')) {
            $policy_modules += array('policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite');
        }
        foreach ($policy_modules as $key => $name) {
            if ($config[$name] === '0') {
                unset($policy_modules[$key]);
            }
        }
        $policy = '';
        if (@extension_loaded('gd') && sizeof($policy_modules)) {
            include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
            $policy = $policy_modules[array_rand($policy_modules)];
        } else {
            include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
        }
        $captcha = new captcha();
        $captcha->execute($row['code'], $policy);
        exit;
    }
开发者ID:yunsite,项目名称:gloryroad,代码行数:40,代码来源:ucp_confirm.php

示例5: captcha

<?php

exit;
$code = "1234567890";
$seed = 1231413213;
$captcha_gd = false;
if ($captcha_gd) {
    include './captcha_gd.php';
} else {
    include './captcha_non_gd.php';
}
$captcha = new captcha();
$captcha->execute($code, $seed);
exit;
开发者ID:saydulk,项目名称:a2billing,代码行数:14,代码来源:test_captcha.php


注:本文中的captcha::execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。