getCode() 공개 메소드

Get the captcha code
부터: 1.0.1
public getCode ( ) : string
리턴 string
예제 #1
0
 public function postRegistro()
 {
     include_once public_path() . '/securimage/securimage.php';
     $securimage = new Securimage();
     $captcha_sesion = strtoupper($securimage->getCode());
     include app_path() . "/include/cifrado.php";
     $usuario = new Usuario();
     $data = Input::all();
     $data['captcha_sesion'] = $captcha_sesion;
     $data['captcha_code'] = strtoupper($data['captcha_code']);
     $data['fecha_nacimiento'] = $data['anyo'] . "-" . $data['mes'] . "-" . $data['dia'];
     foreach ($data as $key => $value) {
         if ($key != 'password' && $key != 'email') {
             $data[$key] = mb_strtoupper($value, 'UTF-8');
         }
     }
     $data['password'] = encriptar($data['password']);
     $data['cod_verif'] = rand(111111, 999999);
     if (!$usuario->isValid($data)) {
         return Redirect::action('Usuario_UsuarioController@getRegistro')->withInput(Input::except('password'))->withErrors($usuario->errors)->with('id_municipio', $data['municipio']);
     }
     $usuario->fill($data);
     $usuario->save();
     return Redirect::action('Usuario_UsuarioController@getVerificar', array($usuario->id))->with('message_ok', 'Registro Completado. 
 			Por favor, inserte el código de verificación que le hemos enviado a su correo electrónico. Gracias');
 }
예제 #2
0
 /**
  * 检查验证码(会使验证码失效)
  *
  * @param string $code  被检测的验证码
  */
 public function getCheckCaptchaAction($code)
 {
     require APP_PATH . 'libraries/securimage/securimage.php';
     $img = new \Securimage(array('session' => $this->session));
     $data = array('name' => 'captcha', 'result' => (bool) (strtolower($img->getCode()) === strtolower($code)));
     $this->responseJson('200', 'OK', $data);
 }
예제 #3
0
 public function generate()
 {
     $config = configHelper::getConfig()['securimageConfig'];
     $si = new \Securimage($config);
     //securimage write the image data to output buffer, we should get it and clean output buffer and encode image data to a base64 string.
     $si->show();
     $imageData = ob_get_contents();
     ob_get_clean();
     $imageStr = base64_encode($imageData);
     $imageCode = $si->getCode(false, true);
     return ['data' => $imageStr, 'code' => $imageCode];
 }
예제 #4
0
 /**
  * @inheritdoc
  */
 protected function generate($generate = false)
 {
     if (!empty($this->data) && $generate === false) {
         return $this->data;
     }
     switch ($this->provider->image_type) {
         case Securimage::SI_IMAGE_JPEG:
             $this->data['mimeType'] = 'image/jpeg';
             break;
         case Securimage::SI_IMAGE_GIF:
             $this->data['mimeType'] = 'image/gif';
             break;
         default:
             $this->data['mimeType'] = 'image/png';
             break;
     }
     ob_start();
     $this->provider->show();
     $this->data['image'] = ob_get_clean();
     $this->code = $this->provider->getCode([], true);
     return $this->data;
 }
예제 #5
0
파일: reg.php 프로젝트: bumasa/casino
$fields_map['r_name'] = REGXP__RUS_AND_ENG_WORD;
$fields_map['r_fam'] = REGXP__RUS_AND_ENG_WORD;
$fields_map['r_country'] = REGXP__NUM_OR_SELECT;
$fields_map['r_city'] = REGXP__SITY_WORD;
$fields_map['r_birthdayd'] = REGXP__NUM_OR_SELECT;
$fields_map['r_birthdaym'] = REGXP__NUM_OR_SELECT;
$fields_map['r_birthdayy'] = REGXP__NUM_OR_SELECT;
$fields_map['r_antispam'] = REGXP__ENG_WORD;
$fields_map['r_rules'] = REGXP__NUM_OR_SELECT;
//Создаем карту проверки формы. (логика)
//_POST значени проверять не надо! Они уже проверены будут к тому моменту.
$fields_logic_map = array();
$fields_logic_map['r_pass'] = $_POST['r_pass_test'];
$fields_logic_map['r_pass_test'] = $_POST['r_pass'];
$img = new Securimage();
$fields_logic_map['r_antispam'] = $img->getCode();
$fields_logic_map['r_rules'] = 1;
$unique_fields['r_login'] = "******";
$unique_fields['r_email'] = "email";
//// Функции ------------
//Фукция для распечатывания Элементов массива.
//Аргументы: Массив, Шаблон (формат тут - http://ru.php.net/manual/ru/function.sprintf.php)
function draw_element($array, $temple)
{
    $return = NULL;
    if (isset($array['start_value'])) {
        $return .= sprintf(str_replace("%d", "%s", $temple), '---', $array['start_value']);
        unset($array['start_value']);
    }
    if (isset($array['numeric']) && is_numeric($array['numeric'][0]) && is_numeric($array['numeric'][1])) {
        for ($n = $array['numeric'][0]; $n <= $array['numeric'][1]; $n++) {
예제 #6
0
<?php
require_once './dblink.php';
require_once './imports/securimage/securimage.php';

if ( (isset($_POST["kullanici_tc_no"])) && (isset($_POST["kullanici_parola"])) ) {
    $si = new Securimage();
    if (strtolower($si->getCode()) == strtolower($_POST["security_code"])) {
        if (intval(fnc("ck_teb_kullanici", "p:kullanici_tc_no,p:kullanici_parola")) == 1) {
            session_start();
            $_SESSION["kullanici_tc_no"] = $_POST["kullanici_tc_no"];
            //die("Location: prv.php?op=main");
            header("Location: prv.php?op=main");
        } else {
            //die("Location: pub.php?op=wrong_pass");
            header("Location: pub.php?op=wrong_pass");
        }
    } else {
        //die("Location: pub.php?op=wrong_code");
        header("Location: pub.php?op=wrong_code");        
    }
} else {
    //die("Location: pub.php?op=illegal");
    header("Location: pub.php?op=illegal");
}

예제 #7
0
<?php

error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
// Wimpy mode
ini_set('session.use_only_cookies', true);
session_start();
require_once dirname(__FILE__) . '/../../includes/symbionts/securimage/securimage.php';
$image = new Securimage();
// Set some variables
$image->use_wordlist = false;
$image->gd_font_file = realpath(dirname(__FILE__) . '/../../includes/symbionts/securimage/gdfonts/bublebath.gdf');
$image->ttf_file = realpath(dirname(__FILE__) . '/../../includes/symbionts/securimage/elephant.ttf');
$image->show();
// Use our own session variable
$_SESSION['captcha'] = $image->getCode();
예제 #8
0
 protected function _handle_submit($fields, $labels)
 {
     global $post, $securimage;
     $errors = array();
     $values = array();
     if ($fields['captcha']['show'] == true) {
         if (isset($_POST['captcha_code'])) {
             $securimage = new Securimage();
             if (strtolower($_POST['captcha_code']) != $securimage->getCode()) {
                 $errors['captcha'] = '<div class="form-field-error">' . $labels['captcha_error'] . '</div>';
             }
         } else {
             $errors['captcha'] = '<div class="form-field-error">' . $labels['argument_error'] . '</div>';
         }
     }
     foreach ($fields as $k => $v) {
         if ($k == 'captcha' || $k == 'copy') {
             continue;
         }
         $field = $v['id'];
         $val = isset($_POST[$field]) ? $_POST[$field] : null;
         if ($val && !is_array($val)) {
             $val = trim($val);
         }
         if ($v['required'] && empty($val)) {
             $errors[$field] = '<div class="form-field-error">' . $labels['field_error'] . '</div>';
         } elseif ($v['type'] === 'numbers' && !empty($val)) {
             if (is_numeric(str_replace(' ', '', $val)) === false) {
                 $errors[$field] = '<div class="form-field-error">' . $labels['number_error'] . '</div>';
             } else {
                 $values[$field] = $val;
             }
         } elseif ($v['required'] === 'email') {
             if (filter_var($val, FILTER_VALIDATE_EMAIL) === false) {
                 $errors[$field] = '<div class="form-field-error">' . $labels['email_error'] . '</div>';
             } else {
                 $values[$field] = $val;
             }
         } else {
             if (!is_array($val)) {
                 $values[$field] = stripslashes(nl2br($val));
             } else {
                 $values[$field] = $val;
                 foreach ($values[$field] as &$value) {
                     $value = stripslashes(trim($value));
                 }
             }
         }
     }
     // end foreach
     return array('values' => $values, 'errors' => $errors);
 }