示例#1
0
 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));
 }
 public function captcha()
 {
     $this->load->library('captcha');
     $captcha = new Captcha();
     $this->session->data['captcha'] = $captcha->getCode();
     $captcha->showImage();
 }
示例#3
0
 public function index()
 {
     $c = new Captcha();
     $c->doimg();
     $code = $c->getCode();
     session("myf_code", $code);
 }
示例#4
0
 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__);
 }
示例#5
0
 public function getCode()
 {
     return Captcha::getCode();
 }
示例#6
0
 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);
 }
示例#7
0
 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));
 }
示例#8
0
 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));
 }
示例#9
0
 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());
 }
示例#10
0
 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);
 }
示例#11
0
文件: verify.php 项目: rszabo/egalite
<?php

/**
 * This script generates an image containing an asymmetric key used by login.
 *
 * @author    Richard K. Szabó <*****@*****.**>
 * @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();
示例#12
0
 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();
     }
 }
示例#13
0
<?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');