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


PHP Captcha::set_difficulty方法代码示例

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


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

示例1: array

 if (!empty($errstr)) {
     $Errorh->handler($errstr, E_USER_NOTICE);
 }
 if (isset($LANG[$get_erroru])) {
     $Errorh->handler($LANG[$get_erroru], E_USER_WARNING);
 }
 $Template->assign_vars(array('C_REGISTER' => true));
 if ($CONFIG_USER['activ_mbr'] == '1') {
     $Template->assign_block_vars('activ_mbr', array('L_ACTIV_MBR' => $LANG['activ_mbr_mail']));
 } elseif ($CONFIG_USER['activ_mbr'] == '2') {
     $Template->assign_block_vars('activ_mbr', array('L_ACTIV_MBR' => $LANG['activ_mbr_admin']));
 }
 import('util/captcha');
 $Captcha = new Captcha();
 if ($Captcha->is_available() && $CONFIG_USER['verif_code'] == '1') {
     $Captcha->set_difficulty($CONFIG_USER['verif_code_difficulty']);
     $Template->assign_vars(array('C_VERIF_CODE' => true, 'VERIF_CODE' => $Captcha->display_form(), 'L_REQUIRE_VERIF_CODE' => $Captcha->js_require()));
 }
 if ($CONFIG_USER['activ_up_avatar'] == 1) {
     $Template->assign_block_vars('upload_avatar', array('WEIGHT_MAX' => $CONFIG_USER['weight_max'], 'HEIGHT_MAX' => $CONFIG_USER['height_max'], 'WIDTH_MAX' => $CONFIG_USER['width_max']));
 }
 $array_identifier = '';
 $lang_identifier = '../images/stats/other.png';
 foreach ($LANGS_CONFIG as $lang => $array_info) {
     if ($array_info['secure'] == -1) {
         $info_lang = load_ini_file('../lang/', $lang);
         $selected = '';
         if ($CONFIG['lang'] == $lang) {
             $selected = ' selected="selected"';
             $lang_identifier = '../images/stats/countries/' . $info_lang['identifier'] . '.png';
         }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:register.php

示例2: display

 function display($integrated_in_environment = INTEGRATED_IN_ENVIRONMENT, $Template = false, $page_path_to_root = '')
 {
     global $Cache, $User, $Errorh, $Sql, $LANG, $CONFIG, $CONFIG_USER, $CONFIG_COM, $_array_rank, $_array_groups_auth, $Session;
     if ($integrated_in_environment) {
         $idcom_get = retrieve(GET, 'com', 0);
         $idcom_post = retrieve(POST, 'idcom', 0);
         $idcom = $idcom_post > 0 ? $idcom_post : $idcom_get;
         $this->set_arg($idcom);
     }
     $vars_simple = sprintf($this->vars, 0);
     $delcom = retrieve(GET, 'delcom', 0);
     $editcom = retrieve(GET, 'editcom', 0);
     $updatecom = retrieve(GET, 'updatecom', false);
     $path_redirect = $this->path . sprintf(str_replace('&', '&', $this->vars), 0) . (!empty($page_path_to_root) && !$integrated_in_environment ? '&path_to_root=' . $page_path_to_root : '');
     if (!is_object($Template) || strtolower(get_class($Template)) != 'template') {
         $Template = new Template('framework/content/com.tpl');
     }
     if ($this->is_loaded()) {
         $Cache->load('com');
         import('util/captcha');
         $captcha = new Captcha();
         $captcha->set_difficulty($CONFIG_COM['com_verif_code_difficulty']);
         ###########################Insertion##############################
         if (retrieve(POST, 'valid_com', false) && !$updatecom) {
             if ($User->get_attribute('user_readonly') > time()) {
                 $Errorh->handler('e_auth', E_USER_REDIRECT);
             }
             $login = retrieve(POST, 'login', '');
             $contents = retrieve(POST, 'contents', '', TSTRING_UNCHANGE);
             if (!empty($login) && !empty($contents)) {
                 if ($this->lock_com >= 1 && !$User->check_level(MODO_LEVEL)) {
                     redirect($path_redirect);
                 }
                 if ($User->check_level($CONFIG_COM['com_auth'])) {
                     $check_time = $User->get_attribute('user_id') !== -1 && $CONFIG['anti_flood'] == 1 ? $Sql->query("SELECT MAX(timestamp) as timestamp FROM " . DB_TABLE_COM . " WHERE user_id = '" . $User->get_attribute('user_id') . "'", __LINE__, __FILE__) : '';
                     if (!empty($check_time) && !$User->check_max_value(AUTH_FLOOD)) {
                         if ($check_time >= time() - $CONFIG['delay_flood']) {
                             redirect($path_redirect . '&errorh=flood#errorh');
                         }
                     }
                     if ($CONFIG_COM['com_verif_code'] && !$captcha->is_valid()) {
                         redirect($path_redirect . '&errorh=verif#errorh');
                     }
                     $contents = strparse($contents, $CONFIG_COM['forbidden_tags']);
                     if (!check_nbr_links($login, 0)) {
                         redirect($path_redirect . '&errorh=l_pseudo#errorh');
                     }
                     if (!check_nbr_links($contents, $CONFIG_COM['max_link'])) {
                         redirect($path_redirect . '&errorh=l_flood#errorh');
                     }
                     $last_idcom = $this->add($contents, $login);
                     redirect($path_redirect . '#m' . $last_idcom);
                 } else {
                     redirect($path_redirect . '&errorh=auth#errorh');
                 }
             } else {
                 redirect($path_redirect . '&errorh=incomplete#errorh');
             }
         } elseif ($updatecom || $delcom > 0 || $editcom > 0) {
             if ($User->get_attribute('user_readonly') > time()) {
                 $Errorh->handler('e_auth', E_USER_REDIRECT);
             }
             $row = $Sql->query_array(DB_TABLE_COM, '*', "WHERE idcom = '" . $this->idcom . "' AND idprov = '" . $this->idprov . "' AND script = '" . $this->script . "'", __LINE__, __FILE__);
             $row['user_id'] = (int) $row['user_id'];
             if ($this->idcom != 0 && ($User->check_level(MODO_LEVEL) || $row['user_id'] === $User->get_attribute('user_id') && $User->get_attribute('user_id') !== -1)) {
                 if ($delcom > 0) {
                     $Session->csrf_get_protect();
                     $lastid_com = $this->del();
                     $lastid_com = !empty($lastid_com) ? '#m' . $lastid_com : '';
                     redirect($path_redirect . $lastid_com);
                 } elseif ($editcom > 0) {
                     $Template->assign_vars(array('CURRENT_PAGE_COM' => $integrated_in_environment, 'POPUP_PAGE_COM' => !$integrated_in_environment, 'AUTH_POST_COM' => true));
                     if ($row['user_id'] !== -1) {
                         $Template->assign_vars(array('C_HIDDEN_COM' => true, 'LOGIN' => $User->get_attribute('login')));
                     } else {
                         $Template->assign_vars(array('C_VISIBLE_COM' => true, 'LOGIN' => $row['login']));
                     }
                     $Template->assign_vars(array('IDPROV' => $row['idprov'], 'IDCOM' => $row['idcom'], 'SCRIPT' => $this->script, 'CONTENTS' => unparse($row['contents']), 'DATE' => gmdate_format('date_format', $row['timestamp']), 'THEME' => get_utheme(), 'KERNEL_EDITOR' => display_editor($this->script . 'contents', $CONFIG_COM['forbidden_tags']), 'L_LANGUAGE' => substr(get_ulang(), 0, 2), 'L_EDIT_COMMENT' => $LANG['edit_comment'], 'L_REQUIRE_LOGIN' => $LANG['require_pseudo'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_DELETE_MESSAGE' => $LANG['alert_delete_msg'], 'L_LOGIN' => $LANG['pseudo'], 'L_MESSAGE' => $LANG['message'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_PREVIEW' => $LANG['preview'], 'L_SUBMIT' => $LANG['update'], 'U_ACTION' => $this->path . sprintf($this->vars, $this->idcom) . '&token=' . $Session->get_token() . '&updatecom=1' . (!empty($page_path_to_root) && !$integrated_in_environment ? '&path_to_root=' . $page_path_to_root : '')));
                 } elseif ($updatecom) {
                     $contents = retrieve(POST, 'contents', '', TSTRING_UNCHANGE);
                     $login = retrieve(POST, 'login', '');
                     if (!empty($contents) && !empty($login)) {
                         $contents = strparse($contents, $CONFIG_COM['forbidden_tags']);
                         if (!check_nbr_links($contents, $CONFIG_COM['max_link'])) {
                             redirect($path_redirect . '&errorh=l_flood#errorh');
                         }
                         $this->update($contents, $login);
                         redirect($path_redirect . '#m' . $this->idcom);
                     } else {
                         redirect($path_redirect . '&errorh=incomplete#errorh');
                     }
                 } else {
                     redirect($path_redirect . '&errorh=incomplete#errorh');
                 }
             } else {
                 $Errorh->handler('e_auth', E_USER_REDIRECT);
             }
         } elseif (isset($_GET['lock']) && $User->check_level(MODO_LEVEL)) {
             $Session->csrf_get_protect();
             if ($User->check_level(MODO_LEVEL)) {
//.........这里部分代码省略.........
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:101,代码来源:comments.class.php

示例3: retrieve

<?php

define('NO_SESSION_LOCATION', true);
require_once '../kernel/begin.php';
require_once '../kernel/header_no_display.php';
header('Content-type: image/jpeg');
$instance = retrieve(GET, 'instance', 1);
$width = retrieve(GET, 'width', 160);
$height = retrieve(GET, 'height', 50);
$font = retrieve(GET, 'font', PATH_TO_ROOT . '/kernel/data/fonts/impact.ttf');
$difficulty = retrieve(GET, 'difficulty', 4);
import('util/captcha');
$Captcha = new Captcha();
$Captcha->set_instance($instance);
$Captcha->set_width($width);
$Captcha->set_height($height);
$Captcha->set_font($font);
$Captcha->set_difficulty($difficulty);
if ($Captcha->is_available()) {
    $Captcha->display();
}
require_once '../kernel/footer_no_display.php';
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:22,代码来源:verif_code.php

示例4: retrieve

<?php

require_once '../kernel/begin.php';
require_once '../guestbook/guestbook_begin.php';
require_once '../kernel/header.php';
$id_get = retrieve(GET, 'id', 0);
$guestbook = retrieve(POST, 'guestbook', false);
$Cache->load('guestbook');
import('util/captcha');
$captcha = new Captcha();
$captcha->set_difficulty($CONFIG_GUESTBOOK['guestbook_difficulty_verifcode']);
if ($guestbook && empty($id_get)) {
    $guestbook_contents = retrieve(POST, 'guestbook_contents', '', TSTRING_UNCHANGE);
    $guestbook_pseudo = retrieve(POST, 'guestbook_pseudo', $LANG['guest']);
    if ($User->get_attribute('user_readonly') > time()) {
        $Errorh->handler('e_readonly', E_USER_REDIRECT);
    }
    if (!empty($guestbook_contents) && !empty($guestbook_pseudo)) {
        if ($User->check_level($CONFIG_GUESTBOOK['guestbook_auth'])) {
            if ($CONFIG_GUESTBOOK['guestbook_verifcode'] && !$captcha->is_valid()) {
                redirect(HOST . SCRIPT . url('?error=captcha', '', '&') . '#errorh');
            }
            $check_time = $User->get_attribute('user_id') !== -1 && $CONFIG['anti_flood'] == 1 ? $Sql->query("SELECT MAX(timestamp) as timestamp FROM " . PREFIX . "guestbook WHERE user_id = '" . $User->get_attribute('user_id') . "'", __LINE__, __FILE__) : '';
            if (!empty($check_time)) {
                if ($check_time >= time() - $CONFIG['delay_flood']) {
                    redirect(HOST . SCRIPT . url('?error=flood', '', '&') . '#errorh');
                }
            }
            $guestbook_contents = strparse($guestbook_contents, $CONFIG_GUESTBOOK['guestbook_forbidden_tags']);
            if (!check_nbr_links($guestbook_pseudo, 0)) {
                redirect(HOST . SCRIPT . url('?error=l_pseudo', '', '&') . '#errorh');
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:guestbook.php

示例5: retrieve

<?php

require_once '../kernel/begin.php';
require_once '../contact/contact_begin.php';
require_once '../kernel/header.php';
$mail_from = retrieve(POST, 'mail_email', '', TSTRING_UNCHANGE);
$mail_object = retrieve(POST, 'mail_object', '', TSTRING_UNCHANGE);
$mail_contents = retrieve(POST, 'mail_contents', '', TSTRING_UNCHANGE);
$mail_valid = retrieve(POST, 'mail_valid', '');
$get_error = '';
import('util/captcha');
$captcha = new Captcha();
$captcha->set_difficulty($CONFIG_CONTACT['contact_difficulty_verifcode']);
###########################Envoi##############################
if (!empty($mail_valid)) {
    if (!$CONFIG_CONTACT['contact_verifcode'] || $captcha->is_valid()) {
        import('io/mail');
        $mail = new Mail();
        if ($mail->send_from_properties($CONFIG['mail'], $mail_object, $mail_contents, $mail_from, '', 'user')) {
            $get_error = 'success';
        } else {
            $get_error = 'error';
        }
    } else {
        $get_error = 'verif';
    }
} elseif (!empty($_POST['mail_valid']) && (empty($mail_email) || empty($mail_contents))) {
    $get_error = 'incomplete';
}
###########################Affichage##############################
$Template->set_filenames(array('contact' => 'contact/contact.tpl'));
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:contact.php


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