本文整理汇总了PHP中Securimage类的典型用法代码示例。如果您正苦于以下问题:PHP Securimage类的具体用法?PHP Securimage怎么用?PHP Securimage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Securimage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show
public static function show($captcha_name, $width = 300, $height = 100)
{
$options = array('send_headers' => FALSE, 'no_exit' => TRUE);
$img = new Securimage($options);
//Change some settings
$img->namespace = $captcha_name;
$img->image_width = $width;
$img->image_height = $height;
$img->perturbation = 0.85;
$img->image_bg_color = new Securimage_Color("#f6f6f6");
$img->use_transparent_text = true;
$img->text_transparency_percentage = 10;
// 100 = completely transparent
$img->num_lines = 7;
$img->line_color = new Securimage_Color("#eaeaea");
$img->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
ob_start();
// start the output buffer
$img->show(BASEPATH . '../application/third_party/securimage/backgrounds/bg6.jpg');
// alternate use: $img->show('/path/to/background_image.jpg');
$imgBinary = ob_get_contents();
// get contents of the buffer
ob_end_clean();
// turn off buffering and clear the buffer
header('Content-Type: image/png');
header('Content-Length: ' . strlen($imgBinary));
echo $imgBinary;
}
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:28,代码来源:captcha_helper.php
示例2: captcha
/**
* 画像作成。
*/
public function captcha()
{
App::import('Vendor', 'Securimage', array('file' => 'securimage/securimage.php'));
$securimage = new Securimage();
$securimage->ttf_file = ROOT . '/vendors/securimage/AHGBold.ttf';
$securimage->show();
}
开发者ID:rasken2003,项目名称:trpg-ranking,代码行数:10,代码来源:TmpUsersController.php
示例3: run
public function run($form)
{
$img = new Securimage();
try {
$code = $form->get('code');
if (!$img->check($code)) {
throw new CaptchaIncorretoException();
}
$nome = $form->get('nome');
$empresa = $form->get('empresa');
$telefone = $form->get('telefone');
$assunto = $form->get('assunto');
$mensagem = $form->get('mensagem');
$msg = new Mensagem(null, $nome, $empresa, $telefone, $assunto, $mensagem, Constants::$_ATIVO);
$fachada = Fachada::getInstance();
$fachada->cadastroMensagem()->cadastrar($msg);
$this->setMessage("Mensagem cadastrada com sucesso.", Constants::$_MSG_SUCCESS);
$this->load('100%');
$this->setForward(Forward::go(FaleConoscoPage::$NM_PAGINA . '&msg_cadastro=sucesso'));
} catch (CaptchaIncorretoException $e) {
$this->setMessage("As letras não foram digitadas corretamente! Por favor, tente novamente...", Constants::$_MSG_ERROR);
$this->load('100%');
$this->setForward(Forward::$_BACK);
}
}
开发者ID:vagnerbarros,项目名称:anphpf,代码行数:25,代码来源:FaleConoscoAction.php
示例4: process_si_contact_form
function process_si_contact_form()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
// if the form has been submitted
/*foreach($_POST as $key => $value) {
if (!is_array($key)) {
// sanitize the input data
if ($key != 'ct_message') $value = strip_tags($value);
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
}
}*/
$captcha = @$_POST['ct_captcha'];
// the user's entry for the captcha code
//$name = substr($name, 0, 64); // limit name to 64 characters
// Only try to validate the captcha if the form has no errors
// This is especially important for ajax calls
require_once dirname(__FILE__) . '/securimage.php';
$securimage = new Securimage();
if ($securimage->check($captcha) == false) {
echo 'denaied123';
} else {
echo 'success123';
}
}
// POST
}
开发者ID:janitham,项目名称:deviceDependent,代码行数:26,代码来源:example_form.php
示例5: test
public function test(&$element, $value, $group = null, &$input = null, &$form = null)
{
// If the field is empty and not required, the field is valid.
require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_mightytouch' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'securimage.php';
$img = new Securimage();
return $img->check($value);
}
开发者ID:AxelFG,项目名称:ckbran-inf,代码行数:7,代码来源:mecaptcha.php
示例6: findpassword
function findpassword()
{
if (strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
$this->load->helper(array('server'));
include_once FCPATH . 'resource/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($this->input->post('captcha_code')) === false) {
json_response(array('success' => FALSE, 'msg' => 'Error Captcha'));
} else {
$this->form_validation->set_rules('username', 'Username Or Email', 'trim|required');
if ($this->form_validation->run() === FALSE) {
json_response(array('success' => FALSE, 'msg' => validation_errors()));
} else {
$username = trim($this->input->post('username'));
$this->db->where('username', $username);
$this->db->or_where('email', $username);
$row = $this->db->get('users')->row();
if ($row) {
// send change password link email to user
json_response(array('success' => TRUE, 'msg' => 'Send Success Info'));
} else {
json_response(array('success' => FALSE, 'msg' => 'Invalid User'));
}
}
}
} else {
$this->load->view('findpassword');
}
}
开发者ID:ishawge,项目名称:cxpcms,代码行数:29,代码来源:Login.php
示例7: postRegistro
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');
}
开发者ID:albafo,项目名称:web.Adehon,代码行数:26,代码来源:UsuarioController.php
示例8: createNew
function createNew()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required|is_unique[user.login]');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('first', 'First', "required");
$this->form_validation->set_rules('last', 'last', "required");
$this->form_validation->set_rules('email', 'Email', "required|is_unique[user.email]");
if ($this->form_validation->run() == FALSE) {
$this->load->view('account/newForm');
} else {
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
echo "The security code entered was incorrect.<br /><br />";
echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
exit;
}
$user = new User();
$user->login = $this->input->post('username');
$user->first = $this->input->post('first');
$user->last = $this->input->post('last');
$clearPassword = $this->input->post('password');
$user->encryptPassword($clearPassword);
$user->email = $this->input->post('email');
$this->load->model('user_model');
$error = $this->user_model->insert($user);
$this->load->view('account/loginForm');
}
}
开发者ID:ajitpawar,项目名称:connect4,代码行数:30,代码来源:account.php
示例9: createNew
function createNew()
{
include_once $_SERVER['DOCUMENT_ROOT'] . '/tanks/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// you should handle the error so that the form processor doesn't continue
// or you can use the following code if there is no validation
echo "The security code entered was incorrect.<br /><br />";
echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
exit;
}
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required|is_unique[user.login]');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('first', 'First', "required");
$this->form_validation->set_rules('last', 'last', "required");
$this->form_validation->set_rules('email', 'Email', "required|is_unique[user.email]");
if ($this->form_validation->run() == FALSE) {
$this->load->view('account/newForm');
} else {
//FIXME: notify user on success
$user = new User();
$user->login = $this->input->post('username');
$user->first = $this->input->post('first');
$user->last = $this->input->post('last');
$clearPassword = $this->input->post('password');
$user->encryptPassword($clearPassword);
$user->email = $this->input->post('email');
$this->load->model('user_model');
$this->user_model->insert($user);
$this->load->view('account/loginForm');
}
}
开发者ID:QamarMirza,项目名称:CSC309,代码行数:34,代码来源:account.php
示例10: getCheckCaptchaAction
/**
* 检查验证码(会使验证码失效)
*
* @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);
}
开发者ID:sujinw,项目名称:passport,代码行数:12,代码来源:UserActionController.php
示例11: actionCaptcha
public function actionCaptcha()
{
require_once dirname(__FILE__) . '/../widget/secureimage/assets/securimage.php';
$img = new \Securimage();
// You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
//$img->ttf_file = dirname(__FILE__) . '/../widget/secureimage/assets/AHGBold.ttf';
//$img->captcha_type = \Securimage::SI_CAPTCHA_WORDS; // show a simple math problem instead of text
//$img->case_sensitive = true; // true to use case sensitve codes - not recommended
//$img->image_height = 90; // height in pixels of the image
//$img->image_width = $img->image_height * M_E *1.5; // a good formula for image size based on the height
//$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
$img->image_bg_color = new \Securimage_Color("#f1f3f4");
// image background color
//$img->text_color = new \Securimage_Color("#000"); // captcha text color
//$img->num_lines = 8; // how many lines to draw over the image
//$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
//$img->image_type = SI_IMAGE_JPEG; // render as a jpeg image
//$img->signature_color = new Securimage_Color(rand(0, 64),
// rand(64, 128),
// rand(128, 255)); // random signature color
if (!empty($_GET['namespace'])) {
$img->setNamespace($_GET['namespace']);
}
$img->show();
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:25,代码来源:AccountController.php
示例12: captchaCheck
public static function captchaCheck()
{
$_POST['captcha_code'] = empty($_POST['captcha_code']) ? '' : $_POST['captcha_code'];
if (include public_path(config('coaster::admin.public') . '/securimage/securimage.php')) {
$secure_image = new \Securimage();
}
return isset($secure_image) ? $secure_image->check($_POST['captcha_code']) : false;
}
开发者ID:web-feet,项目名称:coasterframework,代码行数:8,代码来源:Securimage.php
示例13: check_captha
function check_captha($captcha = "")
{
$securimage = new Securimage();
if ($securimage->check($captcha) == false) {
return false;
} else {
return true;
}
}
开发者ID:selametsubu,项目名称:e-ppid,代码行数:9,代码来源:securimages_lib.php
示例14: validate
public function validate(AF_Element $element) {
if (class_exists('Securimage')) {
$securimage = new Securimage();
return $securimage->check($element->value);
}
else {
die('AF_SecurimageValidator ERROR! Class Securimage not found.');
}
}
开发者ID:renq,项目名称:ML-Lib,代码行数:9,代码来源:SecurimageValidator.php
示例15: is_validate_captcha
function is_validate_captcha($code)
{
// CAPTCHA Class
include_once dirname(__FILE__) . '/lib/securimage/securimage.php';
$securimage = new Securimage();
if (false == $securimage->check($code)) {
return 0;
}
return 1;
}
开发者ID:uiblee,项目名称:wilfully,代码行数:10,代码来源:contact.php
示例16: securimage
public function securimage()
{
$this->load->config('csecurimage');
$active = $this->config->item('si_active');
$allsettings = array_merge($this->config->item($active), $this->config->item('si_general'));
$this->load->library('securimage/securimage');
$img = new Securimage($allsettings);
//$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC;
$img->show(APPPATH . 'libraries/securimage/backgrounds/bg6.png');
}
开发者ID:kabircse,项目名称:CI-HTI-Securimage,代码行数:10,代码来源:secureimagetest.php
示例17: checkCaptcha
/**
* キャプチャコードチェック。
*/
public function checkCaptcha($check)
{
App::import('Vendor', 'Securimage', array('file' => 'securimage/securimage.php'));
$securimage = new Securimage();
foreach ($check as $key => $value) {
if ($securimage->check($value) === false) {
return false;
}
}
return true;
}
开发者ID:rasken2003,项目名称:trpg-ranking,代码行数:14,代码来源:TmpUser.php
示例18: validateCaptcha
function validateCaptcha($captchacode, $errorMsg)
{
$result = "";
include_once 'lib/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($captchacode) == false) {
// the code was incorrect
$result = $errorMsg . "<br />";
}
return $result;
}
开发者ID:dwaard,项目名称:ww_kans3,代码行数:11,代码来源:formvalidationtools.php
示例19: _valid_captcha
public function _valid_captcha($captcha)
{
/*Captcha*/
$this->load->library('securimage');
$securimage = new Securimage();
if (!$securimage->check($captcha)) {
return FALSE;
} else {
return TRUE;
}
}
开发者ID:nathanaelito,项目名称:clickbuena_ci,代码行数:11,代码来源:Contact.php
示例20: verifyCaptcha
function verifyCaptcha($captcha)
{
$this->load->library('securimage/securimage');
$securimage = new Securimage();
// set error message if the captcha code is incorrect
if ($securimage->check($captcha) == false) {
$this->form_validation->set_message('verifyCaptcha', 'Verification code does not match the displayed image');
return false;
}
return true;
}
开发者ID:4cylinder,项目名称:connect4,代码行数:11,代码来源:account.php
注:本文中的Securimage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论