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; }
/** * 画像作成。 */ 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(); }
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); } }
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 }
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); }
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'); } }
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'); }
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'); } }
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'); } }
/** * 检查验证码(会使验证码失效) * * @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); }
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(); }
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; }
function check_captha($captcha = "") { $securimage = new Securimage(); if ($securimage->check($captcha) == false) { return false; } else { return true; } }
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.'); } }
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; }
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'); }
/** * キャプチャコードチェック。 */ 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; }
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; }
public function _valid_captcha($captcha) { /*Captcha*/ $this->load->library('securimage'); $securimage = new Securimage(); if (!$securimage->check($captcha)) { return FALSE; } else { return TRUE; } }
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; }
function securimage_check() { require_once "packages/securimage/securimage.php"; $securimage = new Securimage(); $sickrs = $securimage->check($_POST['securimages']); unset($_POST['securimage']); if (!$sickrs) { return false; } else { return true; } }
/** * */ public function outputAudioFile() { /** * @var $lng ilLanguage */ global $lng; chdir(ilSecurImageUtil::getDirectory()); if ($lng->lang_key != 'en' && in_array($lng->lang_key, self::$supported_audio_languages)) { $this->securimage->audio_path = $this->securimage->securimage_path . '/audio/' . $lng->lang_key . '/'; } $this->securimage->outputAudioFile(); }
function captchacheck($usercode) { global $error, $error_die; include_once 'functions/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($usercode) == false) { $error[] = 'The Validation Code Entered Is Not Correct.'; return false; } else { return true; } }
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]; }
public function getCaptcha(Request $request) { $config = Config::get('securimage'); $captcha = new \Securimage(); $captcha->code_length = $config['length']; $captcha->image_width = $config['width']; $captcha->image_height = $config['height']; $captcha->perturbation = $config['perturbation']; $captcha->case_sensitive = $config['case_sensitive']; $captcha->num_lines = $config['num_lines']; $captcha->charset = $config['charset']; $captcha->show(); }
public function action_index() { // load language \Lang::load('account'); // form submitted if (\Input::method() == 'POST') { $data['account_email'] = \Security::strip_tags(trim(\Input::post('account_email'))); // validate form. $validate = \Validation::forge(); $validate->add('account_email', \Lang::get('account_email'), array(), array('required', 'valid_email')); if (!\Extension\NoCsrf::check()) { // validate token failed $output['form_status'] = 'error'; $output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token'); } elseif (!$validate->run()) { // validate failed $output['form_status'] = 'error'; $output['form_status_message'] = $validate->show_errors(); } else { // validate pass include APPPATH . 'vendor' . DS . 'securimage' . DS . 'securimage.php'; $securimage = new \Securimage(); if ($securimage->check(\Input::post('captcha')) == false) { $output['form_status'] = 'error'; $output['form_status_message'] = \Lang::get('account_wrong_captcha_code'); } else { $continue_form = true; } if (isset($continue_form) && $continue_form === true) { // try to send reset password email $result = \Model_Accounts::sendResetPasswordEmail($data); if ($result === true) { $output['hide_form'] = true; $output['form_status'] = 'success'; $output['form_status_message'] = \Lang::get('account_please_check_your_email_to_confirm_reset_password'); } else { if (is_string($result)) { $output['form_status'] = 'error'; $output['form_status_message'] = $result; } } } } // re-populate form $output['account_email'] = trim(\Input::post('account_email')); } // <head> output ---------------------------------------------------------------------------------------------- $output['page_title'] = $this->generateTitle(\Lang::get('account_forgot_username_or_password')); // <head> output ---------------------------------------------------------------------------------------------- return $this->generatePage('front/templates/account/forgotpw_v', $output, false); }
function add($s) { if (empty($_POST)) { if (isset($_COOKIE['contacts'])) { $errors['val']['contacts'] = $_COOKIE['contacts']; } else { $errors = NULL; } $block_html = Html::pageCommercialAdd($errors); $s->assign("block_html",$block_html); $s->assign("YANDEX_KEY",YANDEX_KEY); $s->assign("LAT_CENTER_REGION",LAT_CENTER_REGION); $s->assign("LON_CENTER_REGION",LON_CENTER_REGION); $s->display("commercial_add.tpl"); } else { $errors = Commercial::checkForm($_REQUEST,''); require_once './libs/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { $errors['captcha']['is_error'] = 1; } if (!isset($errors['is_error'])&&!isset($errors['captcha']['is_error'])) { //Дом уже есть в бд if (isset($_POST['tenement_id']) && $_POST['tenement_id']>0) { $tenement_id = intval($_POST['tenement_id']); $tenement = new Tenement(); $tenement->find($tenement_id); if (!$tenement->id) { echo "Дом не найден"; exit(); } } $commercial_id = Commercial::addStatic($_POST); setcookie('contacts',stripslashes($_POST['contacts'])); $_SESSION['last_commercial_id'] = $commercial_id; if ($commercial_id > 0) header("Location: /commercial.html?action=view&id=".$commercial_id); exit(); } else { //echo "Error:".print_r($errors); $block_html = Html::pageCommercialAdd($errors); $s->assign("YANDEX_KEY",YANDEX_KEY); if (isset($_SESSION['admin'])) $s->assign("is_admin",$_SESSION['admin']); $s->assign("block_html",$block_html); $s->display("commercial_add.tpl"); } } }
public function __construct($Ethna_Backend) { $appid = $Ethna_Backend->getAppId(); session_save_path($Ethna_Backend->getTmpdir()); session_name($appid . 'SESSID'); return parent::__construct(array('session_name' => $appid . 'SESSID')); }
function _process() { global $osC_Language, $messageStack; if (isset($_POST['department_email']) && !empty($_POST['department_email'])) { $department_email = osc_sanitize_string($_POST['department_email']); if (!osc_validate_email_address($department_email)) { $messageStack->add('contact', $osC_Language->get('field_departments_email_error')); } } else { $department_email = STORE_OWNER_EMAIL_ADDRESS; } if (isset($_POST['name']) && !empty($_POST['name'])) { $name = osc_sanitize_string($_POST['name']); } else { $messageStack->add('contact', $osC_Language->get('field_customer_name_error')); } if (isset($_POST['email']) && !empty($_POST['email'])) { $email_address = osc_sanitize_string($_POST['email']); if (!osc_validate_email_address($email_address)) { $messageStack->add('contact', $osC_Language->get('field_customer_concat_email_error')); } } else { $messageStack->add('contact', $osC_Language->get('field_customer_concat_email_error')); } if (isset($_POST['telephone']) && !empty($_POST['telephone'])) { $telephone = osc_sanitize_string($_POST['telephone']); } if (isset($_POST['enquiry']) && !empty($_POST['enquiry'])) { $enquiry = osc_sanitize_string($_POST['enquiry']); } else { $messageStack->add('contact', $osC_Language->get('field_enquiry_error')); } if (ACTIVATE_CAPTCHA == '1') { if (isset($_POST['captcha_code']) && !empty($_POST['captcha_code'])) { $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { $messageStack->add('contact', $osC_Language->get('field_concat_captcha_check_error')); } } else { $messageStack->add('contact', $osC_Language->get('field_concat_captcha_check_error')); } } if ($messageStack->size('contact') === 0) { osc_email(STORE_OWNER, $department_email, $osC_Language->get('contact_email_subject'), $enquiry . '<br /><br /><br />' . $osC_Language->get('contact_telephone_title') . $telephone, $name, $email_address); osc_redirect(osc_href_link(FILENAME_INFO, 'contact=success', 'AUTO', true, false)); } }
function captcha_check($code = "", $auto = true) { session_start(); if ($code == "") { $code = @$_POST['captcha']; } $securimage = new Securimage(); if ($securimage->check($code) == false) { if ($auto) { echo '-44'; exit; } else { return -1; } } else { return 0; } }