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


PHP Captcha::getCode方法代码示例

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


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

示例1: index

 public function index()
 {
     $data['email'] = isset($this->request->post['email']) ? $this->request->post['email'] : ($this->auth->isLogged() ? $this->auth->getEmail() : false);
     $data['subject'] = isset($this->request->post['subject']) ? $this->request->post['subject'] : false;
     $data['message'] = isset($this->request->post['message']) ? $this->request->post['message'] : false;
     if ('POST' == $this->request->getRequestMethod() && $this->_validatePost()) {
         $this->mail->setTo(MAIL_EMAIL_SUPPORT_ADDRESS);
         $this->mail->setReplyTo($this->request->post['email']);
         $this->mail->setSubject($this->request->post['subject']);
         $this->mail->setText($this->request->post['message']);
         $this->mail->send();
         $this->session->setUserMessage(array('success' => tt('Your message was sent successfully!')));
         $data['subject'] = false;
         $data['message'] = false;
     }
     $this->document->setTitle(tt('Contact Us'));
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Contact Us'), 'href' => $this->url->link('common/contact'), 'active' => true)));
     $data['error'] = $this->_error;
     $data['href_common_information_licenses'] = $this->url->link('common/information/licenses');
     $data['href_common_information_terms'] = $this->url->link('common/information/terms');
     $data['href_common_information_faq'] = $this->url->link('common/information/faq');
     $data['guest'] = !$this->auth->isLogged();
     $captcha = new Captcha();
     $this->session->setCaptcha($captcha->getCode());
     $data['captcha'] = $this->url->link('common/contact/captcha');
     $data['action'] = $this->url->link('common/contact');
     $data['alert_success'] = $this->load->controller('common/alert/success');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('common/contact.tpl', $data));
 }
开发者ID:rmcdermott,项目名称:bitsybay,代码行数:31,代码来源:contact.php

示例2: captcha

 public function captcha()
 {
     $this->load->library('captcha');
     $captcha = new Captcha();
     $this->session->data['captcha'] = $captcha->getCode();
     $captcha->showImage();
 }
开发者ID:artlabsdesign,项目名称:missbloom,代码行数:7,代码来源:ULTIMATUMcontactform.php

示例3: index

 public function index()
 {
     $c = new Captcha();
     $c->doimg();
     $code = $c->getCode();
     session("myf_code", $code);
 }
开发者ID:Honvid,项目名称:HCMS,代码行数:7,代码来源:CaptchaController.php

示例4: main

 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $this->load->library('captcha');
     $captcha = new Captcha();
     $this->session->data['captcha'] = $captcha->getCode();
     $captcha->showImage();
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:11,代码来源:captcha.php

示例5: getCode

 public function getCode()
 {
     return Captcha::getCode();
 }
开发者ID:mustafa220,项目名称:HighWord,代码行数:4,代码来源:MSCaptcha.php

示例6: captcha

 public function captcha()
 {
     $this->load->library('captcha');
     $font = $this->config->get('config_captcha_font');
     $captcha = new Captcha();
     $this->session->data['captcha'] = $captcha->getCode();
     $captcha->showImage($font);
 }
开发者ID:ahmatjan,项目名称:OpenCart-Overclocked,代码行数:8,代码来源:quote.php

示例7: create

 public function create()
 {
     $this->document->addScript('/javascript/bootstrap-datepicker.js');
     // Redirect if user is already logged
     if ($this->auth->isLogged()) {
         $this->response->redirect($this->url->link('account/account', '', 'SSL'));
     }
     // Validate & save incoming data
     if ('POST' == $this->request->getRequestMethod() && $this->_validateCreate()) {
         // Generate email approval link
         $approval_code = md5(rand() . microtime() . $this->request->post['email']);
         // Create new user
         if ($this->model_account_user->createUser($this->request->post['username'], $this->request->post['email'], $this->request->post['password'], 1, 1, NEW_USER_STATUS, NEW_USER_VERIFIED, QUOTA_FILE_SIZE_BY_DEFAULT, $approval_code)) {
             // Clear any previous login attempts for unregistered accounts.
             $this->model_account_user->deleteLoginAttempts($this->request->post['email']);
             // Try to login
             if ($this->auth->login($this->request->post['email'], $this->request->post['password'], true)) {
                 // Generate identicon
                 $identicon = new Identicon();
                 $image = new Image($identicon->generateImageResource(sha1($this->request->post['username']), USER_IMAGE_ORIGINAL_WIDTH, USER_IMAGE_ORIGINAL_HEIGHT, IMG_FILTER_GRAYSCALE), true);
                 $image->save(DIR_STORAGE . $this->auth->getId() . DIR_SEPARATOR . 'thumb.' . ALLOWED_IMAGE_EXTENSION);
                 // Send user email
                 $mail = new Mail();
                 $mail->setTo($this->request->post['email']);
                 $mail->setFrom(MAIL_FROM);
                 $mail->setReplyTo(MAIL_INFO);
                 $mail->setSender(MAIL_SENDER);
                 $mail->setSubject(tt('Welcome to the BitsyBay Store!'));
                 $mail->setText(tt("Welcome and thank you for registering!\n\n") . sprintf(tt("Here is your BitsyBay account information:\n\nUsername: %s\nE-mail: %s\nPassword: %s\n\n"), $this->request->post['username'], $this->request->post['email'], $this->request->post['password']) . sprintf(tt("Please, approve your email at the following URL: \n%s"), $this->url->link('account/account/approve', 'approval_code=' . $approval_code, 'SSL')));
                 $mail->send();
                 // Send admin notice
                 $mail = new Mail();
                 $mail->setTo(MAIL_INFO);
                 $mail->setFrom(MAIL_FROM);
                 $mail->setReplyTo(MAIL_INFO);
                 $mail->setSender(MAIL_SENDER);
                 $mail->setSubject(tt('A new customer join us'));
                 $mail->setText(tt('Yes yes yes'));
                 $mail->send();
                 // Redirect to account page
                 //if (isset($this->request->get['redirect'])) {
                 //    $this->response->redirect(base64_decode($this->request->get['redirect']));
                 //} else {
                 $this->response->redirect($this->url->link('account/account', '', 'SSL'));
                 //}
             }
         }
     }
     // Set view variables
     $this->document->setTitle(tt('Create an Account'));
     $data = array();
     $data['error'] = $this->_error;
     $captcha = new Captcha();
     $this->session->setCaptcha($captcha->getCode());
     $data['captcha'] = $this->url->link('account/account/captcha', '', 'SSL');
     $data['action'] = $this->url->link('account/account/create', isset($this->request->get['redirect']) ? 'redirect=' . $this->request->get['redirect'] : false, 'SSL');
     $data['href_account_account_login'] = $this->url->link('account/account/login', '', 'SSL');
     $data['href_account_account_forgot'] = $this->url->link('account/account/forgot', '', 'SSL');
     $data['href_common_information_terms'] = $this->url->link('common/information/terms');
     $data['href_common_information_licenses'] = $this->url->link('common/information/licenses');
     $data['href_common_information_faq'] = $this->url->link('common/information/faq');
     $data['href_common_contact'] = $this->url->link('common/contact');
     $data['username'] = isset($this->request->post['username']) ? $this->request->post['username'] : false;
     $data['email'] = isset($this->request->post['email']) ? $this->request->post['email'] : false;
     $data['accept'] = isset($this->request->post['accept']) ? $this->request->post['accept'] : false;
     $data['alert_danger'] = $this->load->controller('common/alert/danger');
     $data['alert_success'] = $this->load->controller('common/alert/success');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Account'), 'href' => $this->url->link('account/account', '', 'SSL'), 'active' => false), array('name' => tt('Create'), 'href' => $this->url->link('account/account/create', '', 'SSL'), 'active' => true)));
     // Renter the template
     $this->response->setOutput($this->load->view('account/account/create.tpl', $data));
 }
开发者ID:RustyNomad,项目名称:bitsybay,代码行数:73,代码来源:account.php

示例8: create

 public function create()
 {
     $this->document->addScript('/javascript/bootstrap-datepicker.js');
     // Redirect if user is already logged
     if ($this->auth->isLogged()) {
         $this->response->redirect($this->url->link('account/account'));
     }
     // Validate & save incoming data
     if ('POST' == $this->request->getRequestMethod() && $this->_validateCreate()) {
         // Generate email approval link
         $approval_code = md5(rand() . microtime() . $this->request->post['email']);
         $approved = 0;
         // Create new user
         if ($user_id = $this->model_account_user->createUser($this->request->post['username'], $this->request->post['email'], $this->request->post['password'], 1, 1, NEW_USER_STATUS, NEW_USER_VERIFIED, QUOTA_FILE_SIZE_BY_DEFAULT, $approval_code, $approved, isset($this->request->cookie['referrer']) && $this->model_account_user->getUser((int) $this->request->cookie['referrer']) ? (int) $this->request->cookie['referrer'] : false)) {
             // Clear previous login attempts for unregistered accounts.
             $this->model_account_user->deleteLoginAttempts($this->request->post['email']);
             // Try to login
             if ($this->auth->login($this->request->post['email'], $this->request->post['password'], true)) {
                 // Generate identicon
                 $identicon = new Identicon();
                 $image = new Image($identicon->generateImageResource(sha1($this->request->post['username']), USER_IMAGE_ORIGINAL_WIDTH, USER_IMAGE_ORIGINAL_HEIGHT, IMG_FILTER_GRAYSCALE), true);
                 $image->save(DIR_STORAGE . $this->auth->getId() . DIR_SEPARATOR . 'thumb.' . STORAGE_IMAGE_EXTENSION);
                 // Subscription
                 $subscriptions = $this->model_account_subscription->getSubscriptions($this->language->getId());
                 foreach ($subscriptions as $subscription) {
                     $this->model_account_subscription->addUserSubscription($this->auth->getId(), $subscription->subscription_id);
                 }
                 // Add welcome notification
                 $this->model_account_notification->addNotification($user_id, DEFAULT_LANGUAGE_ID, 'common', sprintf(tt('Welcome to %s!'), PROJECT_NAME), tt("We're so happy you've joined us.\n") . tt("Make every day awesome with inspired finds!"));
                 // Send greetings email with verification code
                 $mail_data['project_name'] = PROJECT_NAME;
                 $mail_data['subject'] = sprintf(tt('Welcome to %s!'), PROJECT_NAME);
                 $mail_data['message'] = tt('Welcome and thank you for registering!');
                 $mail_data['href_home'] = $this->url->link('common/home');
                 $mail_data['href_contact'] = $this->url->link('common/contact');
                 $mail_data['href_subscription'] = $this->url->link('account/account/subscription');
                 $mail_data['href_approve'] = $this->url->link('account/account/approve', 'code=' . $approval_code);
                 $mail_data['href_facebook'] = URL_FACEBOOK;
                 $mail_data['href_twitter'] = URL_TWITTER;
                 $mail_data['href_tumblr'] = URL_TUMBLR;
                 $mail_data['href_github'] = URL_GITHUB;
                 $mail_data['module'] = $this->load->view('email/module/approve.tpl', $mail_data);
                 $this->mail->setTo($this->request->post['email']);
                 $this->mail->setSubject($mail_data['subject']);
                 $this->mail->setHtml($this->load->view('email/common.tpl', $mail_data));
                 $this->mail->send();
                 $this->response->redirect($this->url->link('account/account'));
             }
         }
     }
     // Set view variables
     $this->document->setTitle(tt('Create an Account'));
     $data = array();
     $data['error'] = $this->_error;
     $captcha = new Captcha();
     $this->session->setCaptcha($captcha->getCode());
     $data['captcha'] = $this->url->link('account/account/captcha');
     $data['action'] = $this->url->link('account/account/create', isset($this->request->get['redirect']) ? 'redirect=' . $this->request->get['redirect'] : false);
     $data['href_account_account_login'] = $this->url->link('account/account/login');
     $data['href_account_account_forgot'] = $this->url->link('account/account/forgot');
     $data['href_common_information_terms'] = $this->url->link('common/information/terms');
     $data['href_common_information_licenses'] = $this->url->link('common/information/licenses');
     $data['href_common_information_faq'] = $this->url->link('common/information/faq');
     $data['href_common_contact'] = $this->url->link('common/contact');
     $data['username'] = isset($this->request->post['username']) ? $this->request->post['username'] : false;
     $data['email'] = isset($this->request->post['email']) ? $this->request->post['email'] : false;
     $data['accept'] = isset($this->request->post['accept']) ? $this->request->post['accept'] : false;
     $data['alert_danger'] = $this->load->controller('common/alert/danger');
     $data['alert_success'] = $this->load->controller('common/alert/success');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Account'), 'href' => $this->url->link('account/account'), 'active' => false), array('name' => tt('Create'), 'href' => $this->url->link('account/account/create'), 'active' => true)));
     // Renter the template
     $this->response->setOutput($this->load->view('account/account/create.tpl', $data));
 }
开发者ID:babilavena,项目名称:bitsybay,代码行数:75,代码来源:account.php

示例9: captcham

 public function captcham()
 {
     $this->load->library('captcham');
     $this->language->load('record/record');
     $this->data['entry_captcha'] = $this->language->get('entry_captcha');
     $this->data['entry_captcha_title'] = $this->language->get('entry_captcha_title');
     $this->data['entry_captcha_update'] = $this->language->get('entry_captcha_update');
     if ($this->customer->isLogged()) {
         $this->data['captcha_status'] = false;
     } else {
         $this->data['captcha_status'] = true;
         $captcha = new Captcha();
         $this->session->data['captcha'] = $captcha->getCode();
         $this->data['captcha_filename'] = $captcha->makeImage();
         $this->data['captcha_keys'] = "";
         for ($i = 0; $i < strlen($this->session->data['captcha']); $i++) {
             $k = rand(0, 1);
             $pos = strpos($this->data['captcha_keys'], $this->session->data['captcha'][$i]);
             if ($pos === false) {
                 if ($k == 1) {
                     $this->data['captcha_keys'] = $this->data['captcha_keys'] . $this->session->data['captcha'][$i];
                 } else {
                     $this->data['captcha_keys'] = $this->session->data['captcha'][$i] . $this->data['captcha_keys'];
                 }
             }
             //$pos === false
         }
         //$i = 0; $i < strlen($this->session->data['captcha']); $i++
     }
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/record/captcha.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/record/captcha.tpl';
     } else {
         $this->template = 'default/template/record/captcha.tpl';
     }
     $this->data['theme'] = $this->config->get('config_template');
     $this->response->setOutput($this->render());
 }
开发者ID:archweb,项目名称:nprotein,代码行数:37,代码来源:record.php

示例10: captcham

 public function captcham()
 {
     $this->load->library('captcham5');
     $this->language->load('record/record');
     $this->data['entry_captcha'] = $this->language->get('entry_captcha');
     $this->data['entry_captcha_title'] = $this->language->get('entry_captcha_title');
     $this->data['entry_captcha_update'] = $this->language->get('entry_captcha_update');
     if ($this->customer->isLogged()) {
         $this->data['captcha_status'] = false;
     } else {
         $this->data['captcha_status'] = true;
         $captcha = new Captcha();
         $this->session->data['captcha'] = $this->code = $captcha->getCode();
         $this->data['captcha_keys'] = "";
         for ($i = 0; $i < strlen($this->session->data['captcha']); $i++) {
             $k = rand(0, 1);
             $pos = strpos($this->data['captcha_keys'], $this->session->data['captcha'][$i]);
             if ($pos === false) {
                 if ($k == 1) {
                     $this->data['captcha_keys'] = $this->data['captcha_keys'] . $this->session->data['captcha'][$i];
                 } else {
                     $this->data['captcha_keys'] = $this->session->data['captcha'][$i] . $this->data['captcha_keys'];
                 }
             }
         }
     }
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/agootemplates/module/captcham5.tpl')) {
         $this_template = $this->config->get('config_template') . '/template/agootemplates/module/captcham5.tpl';
     } else {
         $this_template = 'default/template/agootemplates/module/captcham5.tpl';
     }
     $this->data['theme'] = $this->config->get('config_template');
     $this->template = $this_template;
     if (SCP_VERSION < 2) {
         $html = $this->render();
     } else {
         if (!is_array($this->data)) {
             $this->data = array();
         }
         $html = $this->load->view($this->template, $this->data);
     }
     $this->response->setOutput($html);
 }
开发者ID:BulatSa,项目名称:Ctex,代码行数:43,代码来源:treecomments.php

示例11: Captcha

<?php

/**
 * This script generates an image containing an asymmetric key used by login.
 *
 * @author    Richard K. Szabó <richard@9eb.se>
 * @file      verify.php
 * @copyright MIT
 */
$auto_login = false;
require "../../include/iq.php";
$captcha = new Captcha(10);
$session->set(Captcha::KEY_LOGIN, $captcha->getCode(), Captcha::LIFETIME_LOGIN);
$captcha->render();
开发者ID:rszabo,项目名称:egalite,代码行数:14,代码来源:verify.php

示例12: captcha

 public function captcha()
 {
     if (!isset($this->request->get['key']) || !($form_info = id::decode($this->request->get['key']))) {
         return;
     }
     if (isset($this->request->get['a']) && $this->request->get['a'] == 'reload') {
         $json = array('url' => str_replace('&amp;', '&', $this->url->link('module/quick_order_pro/captcha', 'key=' . $this->request->get['key'] . '&r=' . uniqid())));
         $this->response->setOutput(json_encode($json));
     } else {
         $setting = $this->getSetting();
         $captcha = new Captcha($setting['captcha_alphabet'], (int) $setting['captcha_count_items']);
         $captcha->line_color = explode(',', $setting['color_line']);
         $captcha->text_color = explode(',', $setting['captcha_color']);
         $captcha->showLine = (int) $setting['show_lines'];
         if ($form_info['position'] == 0) {
             // content
             $captcha->width = 110;
             $captcha->height = 40;
         }
         if (!array_key_exists('quick_order_pro_captcha', $this->session->data)) {
             $this->session->data['quick_order_pro_captcha'] = array();
         }
         $this->session->data['quick_order_pro_captcha'][$this->request->get['key']] = $captcha->getCode();
         $captcha->showImage();
     }
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:26,代码来源:quick_order_pro.php

示例13: Captcha

<?php

session_start();
require_once 'file:///C|/wamp/www/CaptchaCodeManagemant/Captcha.php';
$objCaptcha = new Captcha(60, 20);
$objCaptcha->CreateImage();
$objCaptcha->getImage();
$_SESSION["code"] = $objCaptcha->getCode();
//header('location:../CaptchaCodeManagemant/page.php');
开发者ID:harishankar121,项目名称:gitrepogit,代码行数:9,代码来源:captcha.php


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