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


PHP Captcha::getValue方法代码示例

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


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

示例1: index

 public function index()
 {
     $this->template->setTitle("Register");
     //Load the form validations for if they tried to sneaky bypass our js system
     $this->form_validation->set_rules('register_username', 'username', 'trim|required|min_length[4]|max_length[14]|xss_clean|alpha_numeric');
     $this->form_validation->set_rules('register_email', 'email', 'trim|required|valid_email|xss_clean');
     $this->form_validation->set_rules('register_password', 'password', 'trim|required|min_length[6]|xss_clean');
     $this->form_validation->set_rules('register_password_confirm', 'password confirmation', 'trim|required|matches[register_password]|xss_clean');
     $this->form_validation->set_error_delimiters('<img src="' . $this->template->page_url . 'application/images/icons/exclamation.png" data-tip="', '" />');
     require_once 'application/libraries/captcha.php';
     $captchaObj = new Captcha($this->config->item('use_captcha'));
     if (count($_POST)) {
         $emailAvailable = $this->email_check($this->input->post('register_email'));
         $usernameAvailable = $this->username_check($this->input->post('register_username'));
     } else {
         $emailAvailable = false;
         $usernameAvailable = false;
     }
     //Check if everything went correct
     if ($this->form_validation->run() == FALSE || strtoupper($this->input->post('register_captcha')) != strtoupper($captchaObj->getValue()) || !count($_POST) || !$usernameAvailable || !$emailAvailable) {
         $fields = array('username', 'email', 'password', 'password_confirm');
         if ($this->input->post("r") && $this->external_account_model->userExists($this->input->post("r")) == false) {
             $this->template->view($this->template->loadPage("page.tpl", array("module" => "default", "headline" => "ساخت اکانت", "content" => "<br> خطا : لطفا بر روی  <a href=\"register\">ثبت نام </a> کلیک کنید.")), false, "modules/register/js/validate.js", "ساخت اکانت");
             //die("Error : The recruiter account doesn't exist !");
         }
         $recruiter = 0;
         if ($this->input->post('r')) {
             $recruiter = $this->input->post('r');
         }
         if ($this->input->get('r')) {
             $recruiter = $this->input->get('r');
         }
         $data = array("username_error" => $this->usernameError, "email_error" => $this->emailError, "password_error" => "", "password_confirm_error" => "", "expansions" => $this->realms->getExpansions(), "use_captcha" => $this->config->item('use_captcha'), "captcha_error" => "", "recruiter" => $recruiter, "url" => $this->template->page_url);
         if (count($_POST) > 0) {
             // Loop through fields and assign error or success image
             foreach ($fields as $field) {
                 if (strlen(form_error('register_' . $field)) == 0 && empty($data[$field . "_error"])) {
                     $data[$field . "_error"] = '<img src="' . $this->template->page_url . 'application/images/icons/accept.png" />';
                 } elseif (empty($data[$field . "_error"])) {
                     $data[$field . "_error"] = form_error('register_' . $field);
                 }
             }
             if ($this->input->post('register_captcha') != $captchaObj->getValue()) {
                 $data['captcha_error'] = '<img src="' . $this->template->page_url . 'application/images/icons/exclamation.png" />';
             }
         }
         // If not then display our page again
         $this->template->view($this->template->loadPage("page.tpl", array("module" => "default", "headline" => "ساخت اکانت", "content" => $this->template->loadPage("register.tpl", $data))), false, "modules/register/js/validate.js", "ساخت اکانت");
     } else {
         if ($this->input->post("register_expansion") != false) {
             if (!array_key_exists($this->input->post("register_expansion"), $this->realms->getExpansions())) {
                 die("هوم ، متاسفم ، نمیتوانید پچ را تغییر دهید");
             }
         }
         if (!$this->username_check($this->input->post("register_username"))) {
             die;
         }
         $recruiter = 0;
         if ($this->input->post("r") != false) {
             $recruiter = $this->input->post("r");
         }
         $bridge = false;
         if ($this->config->item('use_forum_bridge')) {
             if (file_exists('application/modules/register/bridges/' . $this->config->item('forum_bridge') . ".php")) {
                 $bridge = true;
             } else {
                 show_error("The forum bridge <b>" . $this->config->item('forum_bridge') . "</b> does not exist in <b>application/modules/register/controllers/bridges/</b>");
                 die;
             }
         }
         if ($this->config->item('enable_email_activation')) {
             $key = $this->activation_model->add($this->input->post('register_username'), $this->input->post('register_password'), $this->input->post('register_email'), $this->input->post('register_expansion'), $recruiter);
             $link = base_url() . 'register/activate/' . $key;
             $this->sendMail($this->input->post('register_email'), $this->config->item('activation_sender_mail'), $this->config->item('server_name') . ': activate account', 'You have created the account ' . $this->input->post('register_username') . ', please go here to activate it: <a href="' . $link . '">' . $link . '</a>');
         } else {
             //Register our user.
             $this->external_account_model->createAccount($this->input->post('register_username'), $this->input->post('register_password'), $this->input->post('register_email'), $this->input->post('register_expansion'));
             $this->updateRecruiter($this->external_account_model->getId($this->input->post('register_username')), $recruiter);
             // Log in
             $sha_pass_hash = $this->user->createHash($this->input->post('register_username'), $this->input->post('register_password'));
             $check = $this->user->setUserDetails($this->input->post('register_username'), $sha_pass_hash);
         }
         // Show success message
         $data = array("url" => $this->template->page_url, "account" => $this->input->post('register_username'), "bridgeName" => $this->config->item('forum_bridge'), "bridge" => $bridge, "username" => $this->input->post('register_username'), "email" => $this->input->post('register_email'), "password" => $this->input->post('register_password'), "email_activation" => $this->config->item('enable_email_activation'));
         $title = $data['email_activation'] ? "لطفا حساب کاربری خود را تایید کنید" : "اکانت شما با موفقیت ساخته شد";
         $this->template->view($this->template->box($title, $this->template->loadPage("register_success.tpl", $data)));
     }
 }
开发者ID:ahuraa,项目名称:Yekta-Cms,代码行数:88,代码来源:register.php

示例2: index

 public function index()
 {
     clientLang("username_limit_length", "register");
     clientLang("username_limit", "register");
     clientLang("username_not_available", "register");
     clientLang("email_not_available", "register");
     clientLang("email_invalid", "register");
     clientLang("password_short", "register");
     clientLang("password_match", "register");
     $this->template->setTitle(lang("register", "register"));
     //Load the form validations for if they tried to sneaky bypass our js system
     $this->form_validation->set_rules('register_username', 'username', 'trim|required|min_length[4]|max_length[14]|xss_clean|alpha_numeric');
     $this->form_validation->set_rules('register_email', 'email', 'trim|required|valid_email|xss_clean');
     $this->form_validation->set_rules('register_password', 'password', 'trim|required|min_length[6]|xss_clean');
     $this->form_validation->set_rules('register_password_confirm', 'password confirmation', 'trim|required|matches[register_password]|xss_clean');
     $this->form_validation->set_error_delimiters('<img src="' . $this->template->page_url . 'application/images/icons/exclamation.png" data-tip="', '" />');
     require_once 'application/libraries/captcha.php';
     $captchaObj = new Captcha($this->config->item('use_captcha'));
     if (count($_POST)) {
         $emailAvailable = $this->email_check($this->input->post('register_email'));
         $usernameAvailable = $this->username_check($this->input->post('register_username'));
     } else {
         $emailAvailable = false;
         $usernameAvailable = false;
     }
     //Check if everything went correct
     if ($this->form_validation->run() == FALSE || strtoupper($this->input->post('register_captcha')) != strtoupper($captchaObj->getValue()) || !count($_POST) || !$usernameAvailable || !$emailAvailable) {
         $fields = array('username', 'email', 'password', 'password_confirm');
         $data = array("username_error" => $this->usernameError, "email_error" => $this->emailError, "password_error" => "", "password_confirm_error" => "", "expansions" => $this->realms->getExpansions(), "use_captcha" => $this->config->item('use_captcha'), "captcha_error" => "", "url" => $this->template->page_url);
         if (count($_POST) > 0) {
             // Loop through fields and assign error or success image
             foreach ($fields as $field) {
                 if (strlen(form_error('register_' . $field)) == 0 && empty($data[$field . "_error"])) {
                     $data[$field . "_error"] = '<img src="' . $this->template->page_url . 'application/images/icons/accept.png" />';
                 } elseif (empty($data[$field . "_error"])) {
                     $data[$field . "_error"] = form_error('register_' . $field);
                 }
             }
             if ($this->input->post('register_captcha') != $captchaObj->getValue()) {
                 $data['captcha_error'] = '<img src="' . $this->template->page_url . 'application/images/icons/exclamation.png" />';
             }
         }
         // If not then display our page again
         $this->template->view($this->template->loadPage("page.tpl", array("module" => "default", "headline" => "Account creation", "content" => $this->template->loadPage("register.tpl", $data))), false, "modules/register/js/validate.js", "Account Creation");
     } else {
         if ($this->input->post("register_expansion") != false) {
             if (!array_key_exists($this->input->post("register_expansion"), $this->realms->getExpansions())) {
                 die("Hey, don't modify the expansion value...");
             }
         }
         if (!$this->username_check($this->input->post("register_username"))) {
             die;
         }
         // Show success message
         $data = array("url" => $this->template->page_url, "account" => $this->input->post('register_username'), "bridgeName" => $this->config->item('forum_bridge'), "username" => $this->input->post('register_username'), "email" => $this->input->post('register_email'), "password" => $this->input->post('register_password'), "email_activation" => $this->config->item('enable_email_activation'));
         if ($this->config->item('use_forum_bridge')) {
             if (file_exists('application/modules/register/plugins/' . $this->config->item('forum_bridge') . ".php")) {
                 $this->plugins->{$this->config->item('forum_bridge')}->register($data['username'], $data['password'], $data['email']);
             } else {
                 show_error("The forum bridge <b>" . $this->config->item('forum_bridge') . "</b> does not exist in <b>application/modules/register/plugins/</b>");
                 die;
             }
         }
         if ($this->config->item('enable_email_activation')) {
             $key = $this->activation_model->add($this->input->post('register_username'), $this->input->post('register_password'), $this->input->post('register_email'), $this->input->post('register_expansion'));
             $link = base_url() . 'register/activate/' . $key;
             sendMail($this->input->post('register_email'), $this->config->item('activation_sender_mail'), $this->config->item('server_name') . ': activate account', 'You have created the account ' . $this->input->post('register_username') . ', please go here to activate it: <a href="' . $link . '">' . $link . '</a>');
         } else {
             //Register our user.
             $this->external_account_model->createAccount($this->input->post('register_username'), $this->input->post('register_password'), $this->input->post('register_email'), $this->input->post('register_expansion'));
             // Log in
             $sha_pass_hash = $this->user->createHash($this->input->post('register_username'), $this->input->post('register_password'));
             $check = $this->user->setUserDetails($this->input->post('register_username'), $sha_pass_hash);
         }
         $title = $data['email_activation'] ? lang("confirm_account", "register") : lang("created", "register");
         $this->template->view($this->template->box($title, $this->template->loadPage("register_success.tpl", $data)));
     }
 }
开发者ID:GlassFace,项目名称:FusionCMS,代码行数:78,代码来源:register.php


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