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


PHP Captcha::is_valid方法代码示例

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


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

示例1: retrieve_value

 /**
  * {@inheritdoc}
  */
 public function retrieve_value()
 {
     $this->captcha->set_html_id($this->get_html_id());
     if ($this->is_enabled()) {
         $this->set_value($this->captcha->is_valid());
     } else {
         $this->set_value(true);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:12,代码来源:FormFieldCaptcha.class.php

示例2: retrieve

 $user_occupation = retrieve(POST, 'user_occupation', '');
 $user_hobbies = retrieve(POST, 'user_hobbies', '');
 $user_desc = retrieve(POST, 'user_desc', '', TSTRING_PARSE);
 $user_sex = retrieve(POST, 'user_sex', 0);
 $user_sign = retrieve(POST, 'user_sign', '', TSTRING_PARSE);
 $user_msn = retrieve(POST, 'user_msn', '');
 $user_yahoo = retrieve(POST, 'user_yahoo', '');
 $user_web = retrieve(POST, 'user_web', '');
 if (!empty($user_web) && strpos($user_web, '://') === false) {
     $user_web = 'http://' . $user_web;
 }
 $user_born = strtodate(retrieve(POST, 'user_born', '0'), $LANG['date_birth_parse']);
 import('util/captcha');
 $Captcha = new Captcha();
 $Captcha->set_difficulty($CONFIG_USER['verif_code_difficulty']);
 if (!($CONFIG_USER['verif_code'] == '1') || $Captcha->is_valid()) {
     if (strlen($login) >= 3 && strlen($password) >= 6 && strlen($password_bis) >= 6) {
         if (!empty($login) && !empty($user_mail) && $password_hash === $password_bis_hash) {
             ####Vérification de la validité de l'avatar####
             $user_avatar = '';
             //Gestion upload d'avatar.
             $dir = '../images/avatars/';
             import('io/upload');
             $Upload = new Upload($dir);
             if (is_writable($dir) && $CONFIG_USER['activ_up_avatar'] == 1) {
                 if ($_FILES['avatars']['size'] > 0) {
                     $Upload->file('avatars', '`([a-z0-9()_-])+\\.(jpg|gif|png|bmp)+$`i', UNIQ_NAME, $CONFIG_USER['weight_max'] * 1024);
                     if (!empty($Upload->error)) {
                         redirect(HOST . DIR . '/member/register' . url('.php?erroru=' . $Upload->error) . '#errorh');
                     } else {
                         $path = $dir . $Upload->filename['avatars'];
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:register_valid.php

示例3: 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

示例4: retrieve

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');
            }
            if (!check_nbr_links($guestbook_contents, $CONFIG_GUESTBOOK['guestbook_max_link'])) {
                redirect(HOST . SCRIPT . url('?error=l_flood', '', '&') . '#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::is_valid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。