本文整理汇总了PHP中captcha类的典型用法代码示例。如果您正苦于以下问题:PHP captcha类的具体用法?PHP captcha怎么用?PHP captcha使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了captcha类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/board');
$captcha_vars = array('captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS');
if (isset($_GET['demo'])) {
$captcha_vars = array_keys($captcha_vars);
foreach ($captcha_vars as $captcha_var) {
$config[$captcha_var] = isset($_REQUEST[$captcha_var]) ? request_var($captcha_var, 0) : $config[$captcha_var];
}
if ($config['captcha_gd']) {
include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
} else {
include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
}
$captcha = new captcha();
$captcha->execute(gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)), time());
exit;
}
$config_vars = array('enable_confirm' => 'REG_ENABLE', 'enable_post_confirm' => 'POST_ENABLE', 'confirm_refresh' => 'CONFIRM_REFRESH', 'captcha_gd' => 'CAPTCHA_GD');
$this->tpl_name = 'acp_captcha';
$this->page_title = 'ACP_VC_SETTINGS';
$form_key = 'acp_captcha';
add_form_key($form_key);
$submit = request_var('submit', '');
if ($submit && check_form_key($form_key)) {
$config_vars = array_keys($config_vars);
foreach ($config_vars as $config_var) {
set_config($config_var, request_var($config_var, ''));
}
$captcha_vars = array_keys($captcha_vars);
foreach ($captcha_vars as $captcha_var) {
$value = request_var($captcha_var, 0);
if ($value >= 0) {
set_config($captcha_var, $value);
}
}
add_log('admin', 'LOG_CONFIG_VISUAL');
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
} else {
if ($submit) {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
} else {
$preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&demo=demo"));
if (@extension_loaded('gd')) {
$template->assign_var('GD', true);
}
foreach ($config_vars as $config_var => $template_var) {
$template->assign_var($template_var, isset($_REQUEST[$config_var]) ? request_var($config_var, '') : $config[$config_var]);
}
foreach ($captcha_vars as $captcha_var => $template_var) {
$var = isset($_REQUEST[$captcha_var]) ? request_var($captcha_var, 0) : $config[$captcha_var];
$template->assign_var($template_var, $var);
$preview_image_src .= "&{$captcha_var}=" . $var;
}
$template->assign_vars(array('CAPTCHA_PREVIEW' => $preview_image_src, 'PREVIEW' => isset($_POST['preview'])));
}
}
}
开发者ID:html,项目名称:PI,代码行数:60,代码来源:acp_captcha.php
示例2: genCaptcha
function genCaptcha()
{
//Create a CAPTCHA
$captcha = new captcha();
$_SESSION['CAPTCHA'] = $captcha->getCaptcha();
exit;
}
开发者ID:RangerWalt,项目名称:ecci,代码行数:7,代码来源:forme.php
示例3: main
function main($id, $mode)
{
global $db, $user, $phpbb_root_path, $config, $phpEx;
// Do we have an id? No, then just exit
$confirm_id = request_var('id', '');
$type = request_var('type', 0);
if (!$confirm_id || !$type) {
exit;
}
// Try and grab code for this id and session
$sql = 'SELECT code, seed
FROM ' . CONFIRM_TABLE . "\n\t\t\tWHERE session_id = '" . $db->sql_escape($user->session_id) . "'\n\t\t\t\tAND confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\tAND confirm_type = {$type}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// If we have a row then grab data else create a new id
if (!$row) {
exit;
}
if ($config['captcha_gd']) {
include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
} else {
include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
}
$captcha = new captcha();
$captcha->execute($row['code'], $row['seed']);
garbage_collection();
exit_handler();
}
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:29,代码来源:ucp_confirm.php
示例4: execute
public function execute()
{
$captcha = new captcha();
if ($captcha->created == false) {
exit;
}
$captcha->to_output();
$this->output->disable();
}
开发者ID:shannara,项目名称:banshee,代码行数:9,代码来源:captcha.php
示例5: action_image
public function action_image()
{
$token = $this->request->param('id');
//removig the & we add to refresh the image.
if (($amp_pos = strpos($token, '&')) > 1) {
$token = substr($token, 0, $amp_pos);
}
$captcha = new captcha();
die($captcha->image($token));
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:10,代码来源:captcha.php
示例6: captcha
public function captcha()
{
$captcha = new captcha();
$config = config('captcha');
// debug($config);
$captcha->setConfig($config);
// $captcha = load('captcha');
$captcha->create();
// debug($captcha);
}
开发者ID:im286er,项目名称:SimplePHP,代码行数:10,代码来源:indexController.php
示例7: createCaptcha
public function createCaptcha()
{
if (!$this->checkRequest()) {
return false;
}
require_once 'lib/form/captcha.php';
$captcha = new \captcha();
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode(['src' => $captcha->png(), 'code' => $captcha->getCode()]));
}
开发者ID:karimo255,项目名称:myblog,代码行数:10,代码来源:ajax.php
示例8: execute
function execute()
{
if (empty($this->code)) {
if (!$this->load_code()) {
// invalid request, bail out
return false;
}
}
$captcha = new captcha();
define('IMAGE_OUTPUT', 1);
$captcha->execute($this->code, $this->seed);
}
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:12,代码来源:captcha_abstract.php
示例9: action_index
public function action_index()
{
//template header
$this->template->title = __('Contact Us');
$this->template->meta_description = __('Contact') . ' ' . core::config('general.site_name');
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Contact Us')));
if ($this->request->post()) {
//captcha check
if (captcha::check('contact')) {
//check if user is loged in
if (Auth::instance()->logged_in()) {
$email_from = Auth::instance()->get_user()->email;
$name_from = Auth::instance()->get_user()->name;
} else {
$email_from = core::post('email');
$name_from = core::post('name');
}
//akismet spam filter
if (!core::akismet($name_from, $email_from, core::post('message'))) {
$replace = array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => $name_from, '[EMAIL.FROM]' => $email_from);
if (Email::content(core::config('email.notify_email'), core::config('general.site_name'), $email_from, $name_from, 'contact-admin', $replace)) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
Alert::set(Alert::WARNING, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('Wrong captcha'));
}
}
$this->template->content = View::factory('pages/contact');
}
开发者ID:Ryanker,项目名称:open-eshop,代码行数:35,代码来源:contact.php
示例10: execute
public function execute()
{
$this->output->title = "Captcha demo";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$valid = captcha::valid_code($_POST["code"]);
$this->output->add_tag("valid", show_boolean($valid));
}
}
开发者ID:shannara,项目名称:banshee,代码行数:8,代码来源:captcha.php
示例11: perform
/**
* Validate capcha public key/turing key
*
* @param array $data
*/
public function perform($data = FALSE)
{
// Captcha privat key!!!
$captcha_privat_key = md5(implode('', file($data['configPath'] . 'dbConnect.php')));
// The ttf font to create turing chars images
$captcha_ttf_font = JAPA_BASE_DIR . 'modules/common/includes/ttf_font/activa.ttf';
// Relative folder of captcha pictures
$captcha_pictures_folder = JAPA_PUBLIC_DIR . 'data/common/captcha';
// Type of turing chars
$captcha_char_type = 'num';
// or 'hex'
$captcha = new captcha($captcha_privat_key, JAPA_BASE_DIR, $captcha_ttf_font, $captcha_pictures_folder, $captcha_char_type);
if (FALSE == $captcha->check_captcha($data['public_key'], $data['turing_key'])) {
return FALSE;
}
return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:22,代码来源:ActionCommonCaptchaValidate.php
示例12: check
function check($value, $idhash, $seccheck, $fromjs, $modid) {
global $_G;
if(!$_G['setting']['my_siteid']) {
return false;
}
$sig = $_G['cookie']['dcaptchasig'];
$data = captcha::validate($value, $sig, $fromjs, $modid);
return $data == '{"errCode":0}';
}
开发者ID:hutao1004,项目名称:yintt,代码行数:9,代码来源:seccode_cloudcaptcha.php
示例13: gorusKaydet
function gorusKaydet()
{
captcha::check("index.php?option=com_yeterlilik_taslak&view=gorus_bildir&standartId=" . JRequest::getVar("standartId"));
$db =& JFactory::getOracleDBO();
$model = $this->getModel('gorus_kaydet');
$post = JRequest::get('post');
$message = $model->gorusKaydet($db, $post);
$this->setRedirect('index.php', $message);
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:9,代码来源:controller.php
示例14: perform
/**
* Create capcha picture and public key
*
* @param array $data
*/
public function perform($data = FALSE)
{
// Captcha privat key!!!
$captcha_privat_key = md5(implode('', file($data['configPath'] . 'dbConnect.php')));
// The ttf font to create turing chars images
$captcha_ttf_font = SMART_BASE_DIR . 'modules/common/includes/ttf_font/activa.ttf';
// Relative folder of captcha pictures
$captcha_pictures_folder = SMART_RELATIVE_PATH . 'data/common/captcha';
// Type of turing chars
$captcha_char_type = 'num';
// or 'hex'
$captcha = new captcha($captcha_privat_key, SMART_BASE_DIR, $captcha_ttf_font, $captcha_pictures_folder, $captcha_char_type);
$captcha->captcha_picture_expire = 300;
$captcha->width = 120;
$captcha->string_len = 5;
$captcha->shadow = FALSE;
$data['captcha_pic'] = $captcha->make_captcha();
//@chmod(SMART_BASE_DIR . $_captcha_pic, 0775);
$data['public_key'] = $captcha->public_key;
return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:26,代码来源:ActionCommonCaptchaMake.php
示例15: main
function main($id, $mode)
{
global $db, $user, $phpbb_root_path, $config, $phpEx;
// Do we have an id? No, then just exit
$confirm_id = request_var('id', '');
$type = request_var('type', 0);
if (!$confirm_id || !$type) {
exit;
}
// Try and grab code for this id and session
$sql = 'SELECT code
FROM ' . CONFIRM_TABLE . " \n\t\t\tWHERE session_id = '" . $db->sql_escape($user->session_id) . "' \n\t\t\t\tAND confirm_id = '" . $db->sql_escape($confirm_id) . "'\n\t\t\t\tAND confirm_type = {$type}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// If we have a row then grab data else create a new id
if (!$row) {
exit;
}
// Some people might want the olde style CAPTCHA even if they have GD enabled, this also saves us from people who have GD but no TTF
$policy_modules = array('policy_entropy', 'policy_3dbitmap');
if (function_exists('imagettfbbox') && function_exists('imagettftext')) {
$policy_modules += array('policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite');
}
foreach ($policy_modules as $key => $name) {
if ($config[$name] === '0') {
unset($policy_modules[$key]);
}
}
$policy = '';
if (@extension_loaded('gd') && sizeof($policy_modules)) {
include $phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx;
$policy = $policy_modules[array_rand($policy_modules)];
} else {
include $phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx;
}
$captcha = new captcha();
$captcha->execute($row['code'], $policy);
exit;
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:40,代码来源:ucp_confirm.php
示例16: ewiki_edit_save_antibot_checkbox
function ewiki_edit_save_antibot_checkbox(&$save, &$data)
{
global $ewiki_errmsg;
if (!$GLOBALS["ewiki_no_bot"]) {
include_once "plugins/lib/captcha.php";
if (!captcha::check()) {
$save = NULL;
$ewiki_errmsg = "Access Forbidden. You did not successfully pass the captcha.";
} else {
$GLOBALS["ewiki_no_bot"] = 1;
}
}
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:13,代码来源:antibot_captcha.php
示例17: NewPromoCommune
/**
* Предложение на создание нового промо сообщества.
*
* @param array $frm Данные введенные пользователем
*
* @return object xajaxResponse
*/
function NewPromoCommune($frm)
{
global $session;
session_start();
$objResponse = new xajaxResponse();
$errors = array();
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/captcha.php';
$captcha = new captcha();
$rnd = $frm['rndnum'];
if (!$captcha->checkNumber(trim($rnd))) {
$errors[] = 'captcha';
}
if (trim($frm['name']) == '') {
$errors[] = 'name';
}
if (trim($frm['msg']) == '') {
$errors[] = 'msg';
}
$objResponse->script('$("popup_promo_commune").getElements("div[id^=popup_promo_commune_err]").setStyle("display", "none");');
if (count($errors)) {
foreach ($errors as $error) {
$objResponse->script('$("popup_promo_commune_err_' . $error . '").setStyle("display", "block");');
}
} else {
$objResponse->script('$("btn_promo_new").setStyle("display", "none");');
$objResponse->script('$("btn_promo_ok").setStyle("display", "block");');
$objResponse->script('$("popup_promo_commune").setStyle("display", "none");');
$objResponse->script('$("claim-name").set("value","");');
$objResponse->script('$("claim-idea").set("value","");');
$objResponse->script('$("claim-cap").set("value","");');
$sm = new smail();
$sm->NewPromoCommune($frm['name'], $frm['msg']);
}
$objResponse->script('$("captcha").set("src","/image.php?r="+Math.random());');
$objResponse->assign('claim-cap', 'value', '');
return $objResponse;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:44,代码来源:commune.server.php
示例18: display
function display($tpl = null)
{
global $mainframe;
$redirect = "index.php?option=com_belge_sorgula&view=belge_sorgula";
$model =& $this->getModel();
$layout = JRequest::getVar("layout");
$kimlik_no = $_POST["kimlik_no"];
//SORGU SONUC
if (isset($layout) && $layout == "sorgu_sonuc") {
//Captcha
captcha::check($redirect);
//Kimlik No
if (!isset($_POST['kimlik_no']) || empty($_POST['kimlik_no'])) {
JError::raiseWarning(100, "Lütfen T.C. Kimlik No Giriniz");
$mainframe->redirect($redirect);
} else {
$data = $model->getBelgeDataByTcKimlikNo($kimlik_no);
$this->assignRef('data', $data);
}
}
parent::display($tpl);
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:22,代码来源:view.html.php
示例19: complete_login
/**
* @return bool true
*/
function complete_login()
{
global $plugins, $db, $mybb, $session;
$user =& $this->login_data;
$plugins->run_hooks('datahandler_login_complete_start', $this);
// Login to MyBB
my_setcookie('loginattempts', 1);
my_setcookie("sid", $session->sid, -1, true);
$ip_address = $db->escape_binary($session->packedip);
$db->delete_query("sessions", "ip = {$ip_address} AND sid != '{$session->sid}'");
$newsession = array("uid" => $user['uid']);
$db->update_query("sessions", $newsession, "sid = '{$session->sid}'");
$db->update_query("users", array("loginattempts" => 1), "uid = '{$user['uid']}'");
$remember = null;
if (!isset($mybb->input['remember']) || $mybb->input['remember'] != "yes") {
$remember = -1;
}
my_setcookie("mybbuser", $user['uid'] . "_" . $user['loginkey'], $remember, true);
if ($this->captcha !== false) {
$this->captcha->invalidate_captcha();
}
$plugins->run_hooks('datahandler_login_complete_end', $this);
return true;
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:27,代码来源:login.php
示例20: action_userprofile_contact
public function action_userprofile_contact()
{
$user = new Model_User($this->request->param('id'));
//message to user
if ($user->loaded() and $this->request->post()) {
if (captcha::check('contact')) {
//akismet spam filter
if (!core::akismet(core::post('name'), core::post('email'), core::post('message'))) {
$ret = $user->email('userprofile.contact', array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => core::post('name'), '[EMAIL.SUBJECT]' => core::post('subject'), '[EMAIL.FROM]' => core::post('email')), core::post('email'), core::post('name'));
//if succesfully sent
if ($ret) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
Alert::set(Alert::SUCCESS, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('You made some mistake'));
}
Request::current()->redirect(Route::url('profile', array('seoname' => $user->seoname)));
}
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:24,代码来源:contact.php
注:本文中的captcha类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论