function render()
 {
     App::import('vendor', 'kcaptcha/kcaptcha');
     //vendor('kcaptcha/kcaptcha');
     $kcaptcha = new KCAPTCHA();
     $this->controller->Session->write('captcha', $kcaptcha->getKeyString());
 }
Example #2
0
function make_captcha($id)
{
    require 'kcaptcha/kcaptcha.php';
    $captcha = new KCAPTCHA();
    cache_set('taxi_captcha_' . $id, $captcha->getKeyString());
    die;
}
Example #3
0
 /**
  * Вывод каптчи:
  */
 public function indexAction(Application $application, Template $template)
 {
     $kvs = KVS::getInstance();
     /*
     		if ($kvs -> exists(__CLASS__, 'captcha_ban', $_SERVER['REMOTE_ADDR']))
     			return false;
     		$kvs -> set(__CLASS__, 'captcha', $_SERVER['REMOTE_ADDR'], $kvs -> get(__CLASS__, 'captcha', $_SERVER['REMOTE_ADDR']) + 1);
     		$kvs -> expire(__CLASS__, 'captcha', $_SERVER['REMOTE_ADDR'], 5);
     
     		if ($kvs -> get(__CLASS__, 'captcha', $_SERVER['REMOTE_ADDR']) > 10) {
     			$kvs -> set(__CLASS__, 'captcha_ban', $_SERVER['REMOTE_ADDR'], true);
     			$kvs -> expire(__CLASS__, 'captcha_ban', $_SERVER['REMOTE_ADDR'], 60 * 15);
     			return false;
     		}
     */
     if (!isset($_GET['key'])) {
         return false;
     }
     /*
     		if (!preg_match('~^http://1chan\.ru/~i', $_SERVER['HTTP_REFERER']))
     		    return false;
     */
     $session = Session::getInstance();
     if ($session->instantGet('captcha_' . $_GET['key'], false)) {
         $captcha = new KCAPTCHA();
         $session->instantSet('captcha_' . $_GET['key'], $captcha->getKeyString());
     }
     return false;
 }
Example #4
0
 public static function render()
 {
     include_once dirname(__FILE__) . '/../libs/kcaptcha/kcaptcha.php';
     $captcha = new KCAPTCHA();
     Session::instance()->set('CAPTHCA_KEYSTRING', $captcha->getKeyString());
     exit(0);
 }
Example #5
0
 public function actionIndex()
 {
     require_once M_FRAME_PATH . '/extensions/captcha/kcaptcha.php';
     $captcha = new KCAPTCHA();
     if ($_REQUEST[session_name()]) {
         $_SESSION['captcha_keystring'] = $captcha->getKeyString();
     }
 }
Example #6
0
 /**
  * Render captcha
  */
 public function render()
 {
     Env::$response->headers->set('Content-Type', 'image/jpeg');
     Env::$response->sendHeaders();
     $captcha = new \KCAPTCHA();
     $_SESSION['captcha_key'] = strtolower($captcha->getKeyString());
     exit;
 }
 function render()
 {
     if (!App::import('Vendor', 'Kcaptcha' . DS . 'Kcaptcha')) {
         App::import('Vendor', 'Kcaptcha.Kcaptcha' . DS . 'Kcaptcha');
     }
     $kcaptcha = new KCAPTCHA();
     $this->Session->write($this->sessionKey, $kcaptcha->getKeyString());
 }
Example #8
0
 /**
  * This function let us to generate a new captcha image. The image code is
  * saved in a session var.
  */
 function render($generateImage = true)
 {
     $captchaCode = "";
     App::import('Vendor', 'kcaptcha/kcaptcha');
     $kcaptcha = new KCAPTCHA($generateImage);
     $captchaCode = $kcaptcha->getKeyString();
     return $captchaCode;
 }
Example #9
0
 protected function EventLibCaptcha()
 {
     if (!class_exists('KCAPTCHA', false)) {
         F::IncludeLib('kcaptcha/kcaptcha.php');
     }
     $captcha = new KCAPTCHA();
     $_SESSION['captcha_keystring'] = $captcha->getKeyString();
     exit;
 }
 public function getKcaptchaImage()
 {
     error_reporting(E_ALL);
     session_start();
     $captcha = new KCAPTCHA();
     if ($_REQUEST[session_name()]) {
         $_SESSION['captcha_keystring'] = $captcha->getKeyString();
     }
 }
 /**
  * キャプチャ画象を表示する
  * 
  * @return void
  */
 public function render($token = null)
 {
     $kcaptcha = new KCAPTCHA();
     $key = 'captcha';
     if (!$token) {
         $token = '0';
     }
     $key .= '.' . $token;
     $this->controller->Session->write($key, $kcaptcha->getKeyString());
 }
Example #12
0
 /**
  * Shows the image
  */
 public function show()
 {
     if (is_file($this->_kcaptchaFilename)) {
         include_once $this->_kcaptchaFilename;
         $this->_instanceCaptcha = new KCAPTCHA();
         rad_session::setVar($this->_sessionName, $this->_instanceCaptcha->getKeyString());
     } else {
         throw new rad_exception('KCaptcha library not found!');
     }
 }
Example #13
0
 public function action_captcha()
 {
     require 'libraries/kapcha/kcaptcha.php';
     if (isset($_REQUEST[session_name()])) {
         session_start();
     }
     $captcha = new KCAPTCHA();
     if ($_REQUEST[session_name()]) {
         $_SESSION['captcha_keystring'] = $captcha->getKeyString();
     }
 }
Example #14
0
 function image()
 {
     // small hack to allow captcha display even if any notice or warning occurred
     $obLength = ob_get_length();
     if ($obLength !== false || $obLength > 0) {
         while (@ob_end_clean()) {
         }
         if (function_exists('ob_clean')) {
             @ob_clean();
         }
     }
     @session_start();
     if (!class_exists('KCAPTCHA')) {
         require_once JCOMMENTS_LIBRARIES . DS . 'kcaptcha' . DS . 'kcaptcha.php';
     }
     $captcha = new KCAPTCHA();
     $_SESSION['comments-captcha-code'] = $captcha->getKeyString();
     exit;
 }
Example #15
0
<?php
/******************************************************************************/
//                                                                            //
//                           InstantCMS v1.10.5                               //
//                        http://www.instantcms.ru/                           //
//                                                                            //
//                   written by InstantCMS Team, 2007-2014                    //
//                produced by InstantSoft, (www.instantsoft.ru)               //
//                                                                            //
//                        LICENSED BY GNU/GPL v2                              //
//                                                                            //
/******************************************************************************/

session_start();

include('kcaptcha.php');

$captcha = new KCAPTCHA();

$captcha_id = filter_input('INPUT_GET', 'captcha_id', FILTER_VALIDATE_INT);

$_SESSION['captcha'][$captcha_id] = $captcha->getKeyString();
Example #16
0
 public function generateImage($config = null)
 {
     $captcha = new \KCAPTCHA();
     Session::set(self::KEYSTRING_KEY, $captcha->getKeyString());
     die;
 }
Example #17
0
<?php

/******************************************************************************
 *
 * Subrion - open source content management system
 * Copyright (C) 2016 Intelliants, LLC <http://www.intelliants.com>
 *
 * This file is part of Subrion.
 *
 * Subrion is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Subrion is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Subrion. If not, see <http://www.gnu.org/licenses/>.
 *
 *
 * @link http://www.subrion.org/
 *
 ******************************************************************************/
require_once IA_PLUGINS . 'kcaptcha' . IA_DS . 'includes' . IA_DS . 'kcaptcha' . IA_DS . 'captcha.php';
$captcha = new KCAPTCHA();
$captcha->length = $iaCore->get('captcha_num_chars');
$captcha->getImage();
$_SESSION['pass'] = $captcha->getKeyString();
Example #18
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/admin/lib/tools/kcaptcha/kcaptcha.php';
session_start();
$captcha = new KCAPTCHA();
$_SESSION['c_sec_code'] = md5($captcha->getKeyString() . 'FWK');
Example #19
0
 /**
  * Генерация проверочного кода
  *
  */
 function captcha()
 {
     include 'modules/kcaptcha/kcaptcha.php';
     $captcha = new KCAPTCHA();
     session_start();
     $_SESSION['captcha_keystring'] = $captcha->getKeyString();
     session_write_close();
     exit;
 }
Example #20
0
<?php

include_once "_common.php";
include_once dirname(__FILE__) . '/kcaptcha_config.php';
include_once 'captcha.lib.php';
while (true) {
    $keystring = '';
    for ($i = 0; $i < $length; $i++) {
        $keystring .= $allowed_symbols[mt_rand(0, strlen($allowed_symbols) - 1)];
    }
    if (!preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $keystring)) {
        break;
    }
}
set_session("ss_captcha_count", 0);
set_session("ss_captcha_key", $keystring);
$captcha = new KCAPTCHA();
$captcha->setKeyString(get_session("ss_captcha_key"));
Example #21
0
            header("Content-Type: image/jpeg");
            imagejpeg($img2, null, $jpeg_quality);
            $ext = 'jpg';
        } else {
            if (function_exists("imagegif")) {
                header("Content-Type: image/gif");
                imagegif($img2);
                $ext = 'gif';
            } else {
                if (function_exists("imagepng")) {
                    header("Content-Type: image/x-png");
                    imagepng($img2);
                    $ext = 'png';
                }
            }
        }
        header('Content-Disposition: inline; filename=' . rand(10, 9999) . '.' . $ext);
        header('Content-Length: ' . ob_get_length());
        ob_end_flush();
    }
    // returns keystring
    function getKeyString()
    {
        return $this->keystring;
    }
}
// Обрабатываем запрос на картинку CAPTCHA
session_name('SESID');
session_start();
$captcha = new KCAPTCHA();
$_SESSION['code'] = $captcha->getKeyString();
<?php

include_once "_common.php";
header("Content-Type: text/html; charset={$g4['charset']}");
require dirname(__FILE__) . '/kcaptcha_config.php';
include 'kcaptcha.php';
while (true) {
    $keystring = '';
    for ($i = 0; $i < $length; $i++) {
        $keystring .= $allowed_symbols[mt_rand(0, strlen($allowed_symbols) - 1)];
    }
    if (!preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $keystring)) {
        break;
    }
}
set_session("captcha_count", 0);
set_session("captcha_keystring", $keystring);
$captcha = new KCAPTCHA();
$captcha->setKeyString(get_session("captcha_keystring"));
<?php

include_once "_common.php";
//error_reporting (E_ALL);
include 'kcaptcha.php';
//session_start();
$captcha = new KCAPTCHA();
$captcha->setKeyString(get_session("captcha_keystring"));
$captcha->getKeyString();
$captcha->image();
Example #24
0
 function render()
 {
     App::import('Vendor', 'Contact.Kcaptcha.Kcaptcha');
     $kcaptcha = new KCAPTCHA();
     $this->controller->Session->write('captcha', $kcaptcha->getKeyString());
 }
Example #25
0
$captcha_conf['length'] = mt_rand(4, 5);
# random 5 or 6
//$length = 6;
# CAPTCHA image size (you do not need to change it, whis parameters is optimal)
$captcha_conf['width'] = 122;
$captcha_conf['height'] = 62;
# symbol's vertical fluctuation amplitude divided by 2
$captcha_conf['fluctuation_amplitude'] = 6;
# increase safety by prevention of spaces between symbols
$captcha_conf['no_spaces'] = false;
# show credits
$captcha_conf['show_credits'] = false;
# set to false to remove credits line. Credits adds 12 pixels to image height
$captcha_conf['credits'] = ' ';
# if empty, HTTP_HOST will be shown
# CAPTCHA image colors (RGB, 0-255)
//$foreground_color = array(0, 0, 0);
//$background_color = array(220, 230, 255);
$captcha_conf['foreground_color'] = array(mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
$captcha_conf['background_color'] = array(mt_rand(200, 255), mt_rand(200, 255), mt_rand(200, 255));
# JPEG quality of CAPTCHA image (bigger is better quality, but larger file size)
$captcha_conf['jpeg_quality'] = 80;
########## End of CAPTCHA configuration
// Print headers to disable image caching
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$captcha = new KCAPTCHA($captcha_conf);
$_SESSION['amember_captcha'] = $captcha->getKeyString();
Example #26
0
<?php

#---------------------------------------------#
#      ********* RotorCMS *********           #
#           Author  :  Vantuz                 #
#            Email  :  visavi.net@mail.ru     #
#             Site  :  http://visavi.net      #
#              ICQ  :  36-44-66               #
#            Skype  :  vantuzilla             #
#---------------------------------------------#
require_once '../includes/start.php';
require_once '../includes/functions.php';
$captcha = new KCAPTCHA();
$_SESSION['protect'] = $captcha->getKeyString();
Example #27
0
<?php

session_start();
require_once 'kcaptcha.php';
$captcha = new KCAPTCHA();
$_SESSION['captcha_keystring'] = $captcha->getKeyString();
Example #28
0
 /**
  * Метод для обновления captcha
  */
 public function captcha()
 {
     $kcaptcha = JPATH_COMPONENT . DS . 'libraries' . DS . 'kcaptcha' . DS . 'kcaptcha.php';
     if (is_file($kcaptcha)) {
         if (!class_exists('KCAPTCHA')) {
             require_once $kcaptcha;
         }
         $captcha = new KCAPTCHA();
         $_SESSION['captcha-code'] = $captcha->getKeyString();
     }
     exit;
 }
Example #29
0
<?php

//error_reporting (E_ALL);
error_reporting(E_ERROR);
include 'kcaptcha.php';
if (isset($_REQUEST[session_name()])) {
    session_start();
}
$id = (int) $_REQUEST['id'];
$id2 = (int) $_REQUEST['id2'];
$captcha = new KCAPTCHA();
if ($_REQUEST[session_name()]) {
    $_SESSION['captcha_keystring' . $id . '_' . $id2] = $captcha->getKeyString();
}
Example #30
0
<?php

include 'kcaptcha.php';
$name = !empty($_GET['name']) ? trim($_GET['name']) : 'captcha_keystring';
session_start();
$captcha = new KCAPTCHA();
$_SESSION[$name] = $captcha->getKeyString();
/**
* SESSION may be work incorrect
*/
$tmp_files = glob('../../logs/captcha_keystring_*.dat');
foreach ($tmp_files as $tmp_file) {
    if (!preg_match('#' . date("Y-m-d") . '\\.dat$#', $tmp_file)) {
        @unlink($tmp_file);
    }
}
@($f = fopen('../../logs/captcha_keystring_' . session_id() . '-' . date("Y-m-d") . '.dat', 'w'));
@fwrite($f, $captcha->getKeyString());
@fclose($f);